For a number of reasons - the main one being that Emacs is amazing! - I am trying to do all my Python development at work in Emacs instead of Pycharm, which I was using previously.
The one component I have not been able to get running right in Emacs is the debugger. I have been trying to use
pdb in emacs to debug the application I am working on, but I haven't been able to figure out how to get
pdb to find all the necessary modules. Instead, when I run my
__main__.py file through pdb, I get a bunch of import errors because it can't find the modules for the project. If I manually add the appropriate paths to
sys.paths and then import the modules one by one from the interactive pdb prompt, this works, but obviously is not the right solution.
In the Pycharm debugger there are two options: "add content roots to PYTHONPATH" and "add source roots to PYTHONPATH", which configure this stuff automatically. My issue is that I haven't figured out how to configure equivalent options in Emacs - i.e., I am not sure how/where to set PYTHONPATH so that
pdb within Emacs recognizes it. I have tried setting it a few different was in my Emacs config, but nothing seems to work. Any suggestions? Thank you!
(setenv "PYTHONPATH" "/the/python/path")in your init file?