Module name conflict with standard library

Felix Wiemann Felix.Wiemann at gmx.net
Sun Sep 5 17:07:23 CEST 2004


Nigel Rowe wrote:

> In the mean time [until PEP 328 is implemented], 
>
>         http://hkn.eecs.berkeley.edu/~dyoo/python/__std__
>
> can help at least some of the problems.

This doesn't always work:

$ cat random.py
from __std__ import random

$ python random.py  # this works

$ cat curses.py
from __std__ import curses

$ python curses.py  # this does not work
Traceback (most recent call last):
  File "curses.py", line 1, in ?
    from __std__ import curses
  File "/usr/lib/python2.3/curses/__init__.py", line 16, in ?
    from curses.wrapper import wrapper                        <--- Uh-oh
  File "/var/home/felix/tmp/curses.py", line 1, in ?
    from __std__ import curses
ImportError: cannot import name curses

So I hope that absolute imports will get implemented in Python 2.4.  I
think I'll name my module 'Curses', as John suggested (even if that's
asking for trouble on Windows systems).

-- 
Felix Wiemann -- http://www.ososo.de/



More information about the Python-list mailing list