I am having trouble getting Pydev to see a module in an import statement. I must be doing something stupid, but I can't figure it out.
I have .pth file in my C:\Python24 folder that contains:
When I configure an interpreter I see both of these folders as candidates for the System PYTHONPATH and I check them both.
When I import something from D:\pythoncommon then Pydev accepts it ok, but when I try to import something from D:\pythoncommon\pydispatch then Pydev gives me an unresolved import error.
When I F9 run the code it works - so the import is being resolved correctly at run-time.
I have tried this with and without PYTHONPATH environment variables, I have run Eclipse -clean and I have removed and re-istalled the Python interpreter. Many times for all of these things!
Upon further investigation it seems to be something to do with having my package in a lower-level folder.
I moved the contents of D:\pythoncommon\pydispatch to a new top-level folder D:\pydispatch, adjusted the .pth file, cleaned eclipse, re-installed the Python interpreter and now my import statement works as expected.
I don't really want to clutter up my top-level folder structure like this, so I would still like to know if there is a better solution.
You should add neither to your system pythonpath.
You should only add the D:\pythoncommon\pydispatch to your project pythonpath. That's a thing with python... you can not have one source inside of the other (because it will go for the one it resolves first).
Doh! I forgot all about the project PYTHONPATH.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.