Issue
Using iPython inside a virtual env (python 2.7.13 and iPython 0.31.1) I am trying to test some code that I have written inside a directory as follows.
Root
Dir1
Dir2
NeedsTesting.py
Dir3
Dir4
Dependency1.py
Inside of NeedsTesting.py
there is an import for Dependency1
. When I am inside the Dir2
directory and try to import NeedsTesting
I get the following error.
ImportError: No module named Dependency1
.
When I got back up to root and try import NeedsTesting.py
the error ImportError: No Module named NeedsTesting.py
.
When I try and call the file like from Dir1/Dir2 import NeedsTesting.py
I get a syntax error pointing to the first /
in the line.
How can I make it so iPython can find modules within an entire project, not just the immediate level?
Solution
Does this help? We need to tell Python which directories to search for modules in.
Answered By - user6764549
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.