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