Run python scene file using execfile?
JadedTuna last edited by
Well, I am trying to make some simple program. I have a socket-file, which containts socket server, that handels clients. And another file,
scenescript.py, which I need to run in some cases. When I have just a blank file with
execfile("scenescript.py"), it runs perfectly. But if I use sockets, I get errors. And scene script starts ONLY after the main file stops. What is wrong? It is not working even with such simple code:
def run(): execfile('scenescript.py') import socket sock = socket.socket() sock.bind(('', 8080)) sock.listen(1) c, a = sock.accept() print a while 1: data = c.recv(1) if data == 'q': break elif data == 'r': run() c.close() sock.close()
P. S. Well, I've managed to fix the errors. But still, scene script starts only after the main file finishes running...