fyears / electron-python-example

Electron as GUI of Python Applications
MIT License
2k stars 234 forks source link

Lost remote after 10000ms - Issue connecting to zerorpc server after packaging python #28

Open spsvision opened 5 years ago

spsvision commented 5 years ago

After packaging the python executable with Pyinstaller, I suddenly have issues with the zerorpc server. It appears that my issue comes after execFile the python executable. I'm able to create the pyprocess, but it isn't able to connect to the python script as it did before when it was just spawning off the script.

This is the exact error: D:_\pyCal\renderer.js:14 Error: Lost remote after 10000ms at Object.createErrorResponse (D:_\pyCal\nodemodules\zerorpc\lib\util.js:53) at ClientChannel. (D:\pyCal\nodemodules\zerorpc\lib\client.js:163) at emitOne (events.js:96) at ClientChannel.emit (events.js:191) at D:\\pyCal\nodemodules\zerorpc\lib\channel.js:198 client.invoke @ D:_\pyCal\renderer.js:14 callbackErrorWrapper @ D:\\pyCal\nodemodules\zerorpc\lib\client.js:105 (anonymous) @ D:\\pyCal\nodemodules\zerorpc\lib\client.js:164 emitOne @ events.js:96 emit @ events.js:191 (anonymous) @ D:\\pyCal\node_modules\zerorpc\lib\channel.js:198

jhampl commented 5 years ago

Same problem here.

rishantagarwal commented 5 years ago

I appreciate all the effort and hardwork put in by you @fyears . This is a great open source project and is quite helpful.

I am getting the same error as mentioned above except after i package the app, it is not able to connect to the server. Do you have any suggestions for this ? @fyears

rishantagarwal commented 5 years ago

I tried running the executable directly and it fails with error

screen shot 2018-09-07 at 17 20 23
kamranIoTDeveloper commented 5 years ago

I am also getting same issue, it seems zerorpc don't work in exe file. Anyone found solution?

brainytwoo commented 5 years ago

Not sure if the issue is exactly the same but I was getting the same error. I fixed it by installing zerorpc via pip. pip install zerorpc

tepsukka commented 4 years ago

I compared an old working package to a newer one that didn't work, and noticed that some folders and files were missing. I'm not sure which of the following fixed it for me, but here's what I did:

For reference, here's a comparison between a working and non working file/folder structure

WORKING (Python 3.6.3)

certifi
Include
lib2to3
tcl
tk
zmq
api.exe
api.exe.manifest
base_library.zip
gevent.libev.corecext.pyd
gevent._semaphore.pyd
greenlet.pyd
msgpack._packer.pyd
msgpack._unpacker.pyd
MSVCP140.dll
pyexpat.pyd
python36.dll
pywintypes36.dll
select.pyd
tcl86t.dll
tk86t.dll
unicodedata.pyd
VCRUNTIME140.dll
win32api.pyd
win32evtlog.pyd
win32wnet.pyd
zmq.backend.cython.constants.pyd
zmq.backend.cython.context.pyd
zmq.backend.cython.error.pyd
zmq.backend.cython.message.pyd
zmq.backend.cython.socket.pyd
zmq.backend.cython.utils.pyd
zmq.backend.cython._device.pyd
zmq.backend.cython._poll.pyd
zmq.backend.cython._version.pyd
_bz2.pyd
_ctypes.pyd
_decimal.pyd
_elementtree.pyd
_hashlib.pyd
_lzma.pyd
_multiprocessing.pyd
_socket.pyd
_ssl.pyd
_testcapi.pyd
_tkinter.pyd

NOT WORKING (Python 3.8)

api.exe
api.exe.manifest
base_library.zip
libcrypto-1_1.dll
libffi-7.dll
libssl-1_1.dll
pyexpat.pyd
python38.dll
select.pyd
unicodedata.pyd
VCRUNTIME140.dll
_asyncio.pyd
_bz2.pyd
_ctypes.pyd
_decimal.pyd
_elementtree.pyd
_hashlib.pyd
_lzma.pyd
_multiprocessing.pyd
_overlapped.pyd
_queue.pyd
_socket.pyd
_ssl.pyd

WORKING AFTER REINSTALLATION (Python 3.6.3)

certifi
gevent
gevent-1.4.0-py3.6.egg-info
Include
lib2to3
msgpack
tcl
tk
win32com
zmq
api.exe
api.exe.manifest
base_library.zip
greenlet.cp36-win_amd64.pyd
mfc140u.dll
MSVCP140.dll
pyexpat.pyd
python36.dll
pythoncom36.dll
pywintypes36.dll
select.pyd
tcl86t.dll
tk86t.dll
unicodedata.pyd
VCRUNTIME140.dll
win32api.pyd
win32evtlog.pyd
win32trace.pyd
win32ui.pyd
win32wnet.pyd
_bz2.pyd
_cffi_backend.cp36-win_amd64.pyd
_ctypes.pyd
_decimal.pyd
_elementtree.pyd
_hashlib.pyd
_lzma.pyd
_multiprocessing.pyd
_socket.pyd
_ssl.pyd
_testcapi.pyd
_tkinter.pyd
_win32sysloader.pyd
tramngo1603 commented 4 years ago

I also experienced this issue when completing the tutorial with Windows 10. The specific problem I experienced was with the .bind method. The python program (bundled as an .exe file with pyinstaller) stopped immediately without logging any errors when it called the .bind method. When I used pdb.set_trace() to debug the issue, this is what I found when stepping through the program:

> .\dist\add\add.exe 4242                                               
> c:\users\tram ngo\desktop\src\electron-python\add.py(14)main()
-> s.bind(addr)
(Pdb) s
--Call--
> c:\users\tram ngo\desktop\src\electron-python\site-packages\zerorpc\socket.py(42)bind()
(Pdb) s
> c:\users\tram ngo\desktop\src\electron-python\site-packages\zerorpc\socket.py(43)bind()
(Pdb) s
--Call--
> c:\users\tram ngo\desktop\src\electron-python\site-packages\zerorpc\events.py(322)bind()
(Pdb) s
> c:\users\tram ngo\desktop\src\electron-python\site-packages\zerorpc\events.py(323)bind()
(Pdb) s
> c:\users\tram ngo\desktop\src\electron-python\site-packages\zerorpc\events.py(324)bind()
(Pdb) s
--Call--
> c:\users\tram ngo\desktop\src\electron-python\site-packages\zerorpc\events.py(305)_resolve_endpoint()
(Pdb) list
[EOF]
(Pdb) n
> c:\users\tram ngo\desktop\src\electron-python\site-packages\zerorpc\events.py(306)_resolve_endpoint()
(Pdb) list
[EOF]
(Pdb) n
> c:\users\tram ngo\desktop\src\electron-python\site-packages\zerorpc\events.py(307)_resolve_endpoint()
(Pdb) n
> c:\users\tram ngo\desktop\src\electron-python\site-packages\zerorpc\events.py(308)_resolve_endpoint()
(Pdb) n
> c:\users\tram ngo\desktop\src\electron-python\site-packages\zerorpc\events.py(313)_resolve_endpoint()
(Pdb) n
--Return--
> c:\users\tram ngo\desktop\src\electron-python\site-packages\zerorpc\events.py(313)_resolve_endpoint()->['tcp://127.0.0.1:4242']
(Pdb) list
[EOF]
(Pdb) n
> c:\users\tram ngo\desktop\src\electron-python\site-packages\zerorpc\events.py(325)bind()
(Pdb) s
> c:\users\tram ngo\desktop\src\electron-python\site-packages\zerorpc\events.py(326)bind()

How I fixed it:

Originally I used Python 2.7 to install Zerorpc and pyinstaller. When I switched to Python 3.7 (in a virtualenv), it worked! I'm not sure why upgrading python version fixed the issue.