General module name clash problem?

jipjip jipjip at
Fri Oct 19 13:09:22 CEST 2007

Hello all,
just new to python..

Suppose i have a directory only with an empty file "".
In this directory i start the python interpreter and say:
 >>> import pygame

What happens?
I get an error message:

Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "/usr/lib/python2.5/site-packages/pygame/", line 147, 
in <module>
     try: import pygame.surfarray
   File "/usr/lib/python2.5/site-packages/Numeric/", line 536, 
in <module>
     class Unpickler(pickle.Unpickler):
AttributeError: 'module' object has no attribute 'Unpickler'

Because pygame needs a module namend ""!
The first location python searches is my directory, so
the library module "" is overwritten with my "".

The cause of this error is not that i import 2 different modules with 
the same name, it's only because there is a file in my directory with 
the same name of a module somewhere in the imported module tree.

I mean, this is a general problem.
Must i look for every module that gets importet for not clashing
with my module files residing in the calling directory?

Is the python package system insufficient, is there something wrong with 
my opinions or do i need a "gotcha"?

Thank's in advance,

More information about the Python-list mailing list