Trouble with debugging and importing
I've setup python packaging to handle paths and this works fine at the python prompt but when I try to run Pycharm debug it seems to not respect the package import feature and unless I attach the other packages to the current project in pycharm I don't see how to get debug to import anything in the package directories.
at python prompt:
from utilities.utilities import get_ste
If I attach the project/package utilities to the current project then in pycharm I must use:
from utilities import get_ste
The problem is we have different packages containing the same module names. Since the above import drops the top level package name, importing the next package overwrites get_ste.
Is there a way to get pycharm debug to respect the existing import statements in the modules that work at the python prompt?
Please sign in to leave a comment.
PyCharm adds the roots of the project to PYTHONPATH. So if you have a directory "utilities" containing a file "utilities.py", and if you want it to be importable as "utilities.utilities", you need to add the parent directory of "utilities" as a content root to your PyCharm project.
The current project is Development/PRTS
The resources packages are
Development/utilities
Development/tools
Development/JIRA
I added the resource packages to the content list for PRTS but pc still listed the libraries as unresolved.
So I removed all content directories and added
Development
This brings in all the other unrelated packages but is this the correct approach?
There are a lot of directories I would need to exclude. Is there a performance issue or other reason I should exclude unused packages.
For example:
Development/JIRA
Development/tools
Development/utilities
The project title shows "Development [JIRA] (/Users/eduvall/ALMA/Development)" so this looks like my project for JIRA. However the project directory does not appear in the project tab, none of the files in the JIRA project are displayed in the project tab and PC warns that JIRA project is already open in project so I cannot add it. The files belonging to the JIRA project that are still open in the editor have lost all perks such as tab completion, bracket highlighting, etc.
I also lost my utilities project in PC. I now have two windows showing tools as the project.
In the tools project the Content directory is Development and the tools directory and files appear in the project tab.
In the JIRA project the Content directory is Development but I only see the files in Development. I don't see the JIRA project directory or files.
If I invalidate the caches in one window/project of PC do I loose all of my editing history in all projects?
<verbatim>
Directory Content root Shows in JIRA project tool
Development/JIRA Development No (It should)
Development/tools Development Yes
Pycharm returns message stating two projects in window cannot have same content root.
If I exclude tools in JIRA project content then the library references to tools change to unresolved.
If in JIRA project I change content root to Development/tools pycharm returns message about not having intersecting content.
I created a project Development as you suggested. This seems to fix the inter-project library referencing and I see how to setup the servers to fit the various needs and I can open the one project in multiple windows though the window names are all the same except for the current file. So this is better than what I was dealing with.
With this arrangement will there be a problem or limitations with distributing projects separately such as Development/JIRA and Development/ASDM?
Thanks,
Gene
</verbatim>