organizing many python scripts, in a large corporate environment.

bukzor workitharder at gmail.com
Sat Mar 12 11:50:46 EST 2011


On Mar 11, 10:14 pm, "eryksun ()" <eryk... at gmail.com> wrote:
> I'm not an expert at Python packaging, but assuming a structure such as
>
> folder1
>        \
>         __init__.py
>         module1.py
> folder2
>        \
>         __init__.py
>         module2.py
>
> within module1, I can import from module2, e.g.:

This only works if you can edit the PYTHONPATH. With thousands of
users and dozens of groups each with their own custom environments,
this is a herculean effort.

$ ./folder1/module1.py
module 1 !
Traceback (most recent call last):
  File "./folder1/module1.py", line 4, in <module>
    import folder2.module2
ImportError: No module named folder2.module2

$ export PYTHONPATH=$PWD
$ ./folder1/module1.py
module 1 !
module 2 !



More information about the Python-list mailing list