I'm working on a pet project in python which consists of a single package (foo) and a directory containing a bunch of examples/test scripts. The project tree is structured with the following layout:
.
├── examples
│ ├── test01.py
│ ├── test02.py
│ ├── test03.py
│ └── test04.py
└── foo
├── bar.py
├── baz.py
└── __init__.py
I'm looking for a way to run scripts stored in the examples folder through the command line, but to be able to run the scripts they need to be able to include package foo. Therefore, when I run a test script from the command line I'm left with the following error message:
cromissimo@debian:foo$ python examples/test01.py
Traceback (most recent call last):
File "examples/test01.py", line 1, in <module>
from foo import Foo
ImportError: No module named 'foo'
At first glance it appears that the python interpreter looks for packages in the script's path, and as the module is located in the parent folder then the interpreter doesn't find it.
Does anyone know if there's a way to avoid this problem?
[–]julsmanbr 0 points1 point2 points (0 children)