How to handle sys.path in bigger projects?

Georg Lohrer GeorgLohrer at gmx.de
Sun Oct 14 06:57:27 EDT 2001


On Sat, 13 Oct 2001 21:45:52 +0100, Ype Kingma
<ykingma at accessforall.nl> wrote:

[snipped]
>> Ok. Let's have a look on it:
>> 
>> 1) actual dir contains directory: "myproject" with its __init__.py
>> importing myproject.foo1 and myproject.foo2
>
>What is the point of these imports in an __init__.py file?

Only for example. Could be omitted.

[snipped]

>> ~user/myproject/foo1> python
>> >>> import foo1foo
>> *** ImportError: No module named myproject.foo2
>
>I suppose foo1foo.py contains sth like
>
>from myproject.foo2 import whatever

Exactly.

[Good advice snipped]

It's strange, but I really was not in trouble with all this stuff
until I'll tried to invoke 'deeper' modules from their directory
level.
After sleeping an additional night about my subject, I recognized that
I've done something substantial wrong, belonging to the "art" of
Python'ing. I'll correct this in the next release.
My organizational structure of the project was based essentially on my
strong C/C++ background and thererfore some mistakes had taken place.

Ciao, Georg



More information about the Python-list mailing list