Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Run python scene file using execfile?
-
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 withexecfile("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...