conflict between my package and os standard module
Ben Wittner
benwittner at mediaone.net
Sun Jan 16 00:05:39 EST 2000
I'm looking for help.
I have a bunch of extensions to standard modules that are pretty
specific to the needs of my project.
I chose to create a package for my project, let's call it my_proj.
In there, I chose to create modules corresponding to standard
modules (e.g., my_proj.os, my_proj.re) to hold the project-specific
extensions of the standard modules.
I put the directory containing my_proj on my PYTHONPATH,
but I did NOT put my_proj on my PYTHONPATH.
In my_proj/os.py I put the following line:
import os
Since my_proj is NOT on my PYTHONPATH, I thought that the line above
would cause the standard module os to be imported.
Instead, it seems that my_proj/os.py is imported.
(I seems that because
(a) I get an attribute error for "path"
when I use os.path.isdir() in my_proj/os.py and
(b) when I print dir(os) I see my_proj.os stuff instead of standard
module os stuff).
I tried taking '' off sys.path, before importing os, but that did not help.
Of course, I could rename my extension modules to things like
os_x.py and re_x.py, but it seems like that should be unecessary
since I'm already indicating that it's part of my project related package
by prepending with "my_proj.".
Any ideas before I rename all my extension packages and change all
references to them?
Thanks.
-Ben
benwittner at yahoo.com
More information about the Python-list
mailing list