Help with pythonpath

Observer observer at moscomono.ath.cx
Wed Jun 1 17:07:26 EDT 2005


Hi, im a newbie both to python and this list.
I hope someone can help me whith this:


I have a directory structure like this:

.
|-- src
|   `-- pkg
|       |-- __init__.py
|       |-- main.py
|       `-- spkg1
|           |-- __init__.py
|           `-- config.py
`-- src2
    `-- pkg
        |-- __init__.py
        `-- spkg2
            |-- __init__.py
            `-- config2.py

and main.py is a python script that contains this imports:

from pkg.spkg1 import config
from pkg.spkg2 import config2

executed in linux whith this:

env PYTHONPATH=src:src2 src/pkg/main.py
Traceback (most recent call last):
  File "src/pkg/main.py", line 4, in ?
    from pkg.spkg2 import config2
ImportError: No module named spkg2

changing the order of the python path only inverts the problem, is there
any way to solve this without changing the directory structure?, or am i
doing something wrong?.
Thanks for your help and excuse my bad english.






More information about the Python-list mailing list