Python packages - problems, pitfalls.

Chuck Esterbrook ChuckEsterbrook at yahoo.com
Mon Nov 5 00:07:33 EST 2001


On Saturday 03 November 2001 22:37, Prabhu Ramachandran wrote:
> Are there better ways to get around this packaging problem?  Is this a
> know problem that folks are working on??  Why is it that Python does
> not deal with this issue more sensibly?

In my project, Webware, we did ended up with the multiple import 
problem you described. eg, where a module was imported twice under 
under "bar" and "foo.bar". This lead to technical problems that were 
unacceptable.

At some level, this was related to the current directory of the 
process. We solved this by tweaking our app server to make sure it 
changed the  current directory to the highest level of our packaging 
system (despite its existence in a subpackage) at the very start before 
any project-specific imports. This solved it.

We use "import SomeModule" when we are importing a module in the same 
directory, or one that is in the python path such os and sys. Otherwise 
we use "import SomePackage.someModule". This works very well and has 
not resulted in any confusion or technical problems.


-Chuck



More information about the Python-list mailing list