my parser.py isn't imported
Torsten Bronger
bronger at physik.rwth-aachen.de
Sun Aug 26 18:47:19 EDT 2007
Hallöchen!
John Machin writes:
> On Aug 27, 1:36 am, Torsten Bronger <bron... at physik.rwth-aachen.de>
> wrote:
>
>> I have a module parser.py in the same directory as the main
>> module. In the main module, I import "parser". On Linux, this
>> works as expected, however on Windows, it imports the stdlib
>> parser module. sys.path[0] points to the directory of my
>> parser.py in both cases. What went wrong here?
>
> Ask a literal question, get a literal answer :-)
>
> 1. Failure to consider that problems can happen [and therefore
> will happen [1]] when there are multiple entities with the same
> name.
So I'd like to know a means to tell *explicitly* what I want to
import. Maybe I could use the imp module but that's ugly. I mean,
there are hundreds of modules on my harddisk, so trying to avoid
nameclashs should not be the solution, and given ...
> 2. Failure to RTFabulousM:
> """
> Details of the module searching and loading process are
> implementation and platform specific. It generally involves
> searching for a ``built- in'' module with the given name and then
> searching a list of locations given as sys.path.
> """
... the whole systems seems largely arbitrary, which I don't
believe. ;-)
"parser" is built-in on Windows but not on Linux. What's the list
of modules that *may* be built-in on some platform or
implementation? Or should I avoid the whole standard lib for names
of my modules? Or even everything which is shipped e.g. with
Enthought Python? I find this quite irritating.
Tschö,
Torsten.
--
Torsten Bronger, aquisgrana, europa vetus
Jabber ID: bronger at jabber.org
(See http://ime.webhop.org for ICQ, MSN, etc.)
More information about the Python-list
mailing list