import module name collision
Robert Brewer
fumanchu at amor.org
Sat Sep 4 14:17:33 EDT 2004
Chris Foote wrote:
> Today I happened to accidentally name one of my project's
> files 'email.py', which collides with the module of the
> same name in Python's standard library:
>
> from email.MIMEText import MIMEText
>
> which causes problems within MIMEText later:
>
> File "/usr/lib/python2.3/smtplib.py", line 49, in ?
> from email.base64MIME import encode as encode_base64
> ImportError: No module named base64MIME
>
> Is there any mechanism to refer to standard library
> modules so that there's no name collision problem with
> the local filename ?
>
> ... or any other solution ?
I assume your 'email.py' is either in /Lib or in /site-packages...? The
quickest solution would be to make your project into a package and shove
your 'email.py' into it somewhere, so it's no longer 'top-level'.
Robert Brewer
MIS
Amor Ministries
fumanchu at amor.org
More information about the Python-list
mailing list