Reputation: 101
When using python packaged as embeddable zip file somewhere on a share and my python apps (there are multiple ones) somewhere else on separate shares I can version the apps separated from each other and from python. The apps then "share" (use) the same python version (embeddable instance) - so I only have to manage one python version for all of my apps.
Now I want do debug one app. (Assuming here: The app already works without errors when running it) I use eclipse and PyDev. After workspace creation and linking the code as folder into a project in the eclipse workspace I tell PyDev where to find my python embeddable interpreter and which app to launch.
When I start debugging the debugger tells me:
Traceback (most recent call last):
File "C:\eclipse\plugins\org.python.pydev.core_7.1.0.201902031515\pysrc\pydevd.py", line 19, in <module>
from _pydev_bundle import fix_getpass
ModuleNotFoundError: No module named '_pydev_bundle'
So the debugger doesn't find ist own modules? Now I add the path of the PyDev sources to the PYTHONPATH of the embeddable python interpreter in the file
python36._pth
as follows:
C:\eclipse\plugins\org.python.pydev.core_7.1.0.201902031515\pysrc
(Yeah that path is not relative) (Side note: I have to reconfigure the interpreter in eclipse to make pydev recognize the path changes)
Doing so resolves that problem and I can debug the app. (Ignoring warnings of the debugger that flood my console)
Can someone tell me why I need to add that path to my python embeddable which should be as independent as possible? Can I setup that somewhere else? I already tried to add the sources path to the eclipse project PYTHONPATH and the eclipse interpreter PYTHONPATH without success.
PS: My python should be independent of the apps to share it between them and to be able to exchange it (fresh upgrade to newer version). The apps are started using a Windows power shell link where I call my python embeddable executable and pass the app as an argument. So double clicking the power shell icon is enough for app users
Upvotes: 0
Views: 691
Reputation: 25332
I didn't really understand one thing: you're launching your code from within Eclipse (say debug as > Python) and it's giving that error?
Are you changing the PYTHONPATH somehow?
The way that it works is that Eclipse/PyDev will change the PYTHONPATH environment variable to add the needed paths for the pydevd
debugger, but if you have a custom Python or zip which is then replacing or not using that var, that result would be expected and you have to make sure that the PYTHONPATH env var is still respected for the debugger to work...
Upvotes: 0