0

I have a script that does the following;

  • Checks if a temp.txt file is present in the working directory.
    • If present the temp.txt file and update.pyd file is removed.
  • Checks whether an update.pyd module is present in the working directory.
    • If present it imports and runs it.
    • The update process creates a temp.txt file in the working directory.
    • After the update the script is restarted using os.execl(sys.executable, sys.executable, *sys.argv)

But I keep getting an error when os.execl(sys.executable, sys.executable, *sys.argv) is called:

Traceback (most recent call last):
  File "<string>", line 73, in execInThread
  File "<string>", line 44, in __call__
  File "C:\Program Files (x86)\PyScripter\Lib\rpyc.zip\rpyc\core\netref.py", line 196, in __call__
  File "C:\Program Files (x86)\PyScripter\Lib\rpyc.zip\rpyc\core\netref.py", line 71, in syncreq
  File "C:\Program Files (x86)\PyScripter\Lib\rpyc.zip\rpyc\core\protocol.py", line 431, in sync_request
  File "C:\Program Files (x86)\PyScripter\Lib\rpyc.zip\rpyc\core\protocol.py", line 379, in serve
  File "C:\Program Files (x86)\PyScripter\Lib\rpyc.zip\rpyc\core\protocol.py", line 337, in _recv
  File "C:\Program Files (x86)\PyScripter\Lib\rpyc.zip\rpyc\core\channel.py", line 50, in recv
  File "C:\Program Files (x86)\PyScripter\Lib\rpyc.zip\rpyc\core\stream.py", line 166, in read
EOFError: [WinError 10054] An existing connection was forcibly closed by the remote host

I have another process in the same script that does something similar, and restarts using os.execl(sys.executable, sys.executable, *sys.argv), but restarts cleanly.

Could someone tell me why this is happening. What "connection" is the error referring to, and how do I close it before restarting? Thanks

I_do_python
  • 1,366
  • 4
  • 16
  • 31
  • 2
    It seems like your IDE problem. See whether you can reproduce it, if you run your Python script from the command-line outside of PyScripter. – jfs Aug 04 '15 at 12:45
  • Thanks. I just switched my python engine from remote to internal and ran the script, and it restarted PyScripter. Ran it from the command line and it just quit the process altogether rather than restart the script. I'll try and cx-freeze it into an application and see if that works (since that's what I intend to do with it anyway). – I_do_python Aug 04 '15 at 12:58

0 Answers0