[Mailman-Users] ImportError: No module named Mailman

Dan Mick dmick at utopia.West.Sun.COM
Fri Jan 11 03:50:46 CET 2002


Indeed:  from http://www.python.org/doc/essays/packages.html:
(note particularly the first parenthetical comment):

What If I Have a Module and a Package With The Same Name?

You may have a directory (on sys.path) which has both a module
spam.py and a subdirectory spam that contains an __init__.py (without
the __init__.py, a directory is not recognized as a package). In this
case, the subdirectory has precedence, and importing spam will ignore
the spam.py file, loading the package spam instead. If you want the
module spam.py to have precedence, it must be placed in a directory
that comes earlier in sys.path.

(Tip: the search order is determined by the list of suffixes returned
by the function imp.get_suffixes(). Usually the suffixes are searched
in the following order: ".so", "module.so", ".py", ".pyc".
Directories don't explicitly occur in this list, but precede all
entries in it.)

> Hmm.  It looks as though the 
> 
> from Mailman import <module>
> 
> won't work as expected (i.e. "use the module search path to look for
> a path named Mailman and look for <module> in there") unless
> Mailman contains __init__.py.  Does it?  (It can be empty, but it
> must exist).
> 
> (The "import" documentation is shady at best.)
> 
> > Dan Mick hit me over the head and suggested strace, so full strace output
> > can be seen at:
> > 
> > http://hank.org/images/mailman.txt
> > 
> > This all started after a reboot one day.  I've run make install from the
> > distribution directory again, just in case some file was missing, but that
> > didn't change anything.
> > 
> > Of course, I'm not clear what mailman is having trouble with.  It stat's
> > for /home/mailman/Mailman, finds it, then tries to open other files.
> > /home/mailman/Mailman exists, so I'm not sure why it doesn't open it.
> > 
> > At this point I'm just as interested to learn how debug and to fix (instead
> > of just fixing it).
> > 
> > stat("/home/mailman/Mailman", {st_mode=S_IFREG|0644, st_size=1649, ...}) = 0
> > open("/home/mailman/Mailman.so", O_RDONLY) = -1 ENOENT (No such file or
> > directory)
> > open("/home/mailman/Mailmanmodule.so", O_RDONLY) = -1 ENOENT (No such file
> > or directory)
> > open("/home/mailman/Mailman.py", O_RDONLY) = -1 ENOENT (No such file or
> > directory)
> > open("/home/mailman/Mailman.pyc", O_RDONLY) = -1 ENOENT (No such file or
> > directory)
> > ...
> > 
> > 
> > 
> > 
> > -- 
> > Bill Moseley
> > mailto:moseley at hank.org
> > 
> > ------------------------------------------------------
> > Mailman-Users maillist  -  Mailman-Users at python.org
> > http://mail.python.org/mailman/listinfo/mailman-users
> 
> 
> ------------------------------------------------------
> Mailman-Users maillist  -  Mailman-Users at python.org
> http://mail.python.org/mailman/listinfo/mailman-users





More information about the Mailman-Users mailing list