importing a sibling module
Clark C . Evans
cce at clarkevans.com
Thu Jan 3 23:27:58 EST 2002
Hello. I have a directory structure that looks
something like...
folder files
/zz/V13/lib tool.py
/zz/V13/app prog.py
/zz/V14/lib tool.py
/zz/V14/app prog.py
Thus, I have two versions of my application, and each
version of the application uses a version of a tool library.
I'm using webware and V13 and V14 are two "contexts",
or directories: http://myserver/V14 and http://myserver/V13
are both served by a single multi-threaded python process.
What I'd like to do, within prog.py is "import ../lib/tool.py"
The best that I can come up with is "from V13.lib import tool"
where my python path includes /zz This solution is brual since
it requires me to run a sed script when incrementing my version
number... to "upgrade" prog.py
Of course, I could simply put "tool.py" in the same directory,
but the real situation is much much more complicated, and this
is the simplest representation I could think of.
Thank you so much for any thoughts!
Clark
More information about the Python-list
mailing list