[SciPy-dev] Bug in scipy import

Travis Oliphant oliphant at ee.byu.edu
Tue Oct 5 05:33:07 EDT 2004


Martin Lüthi wrote:

>Hi
>
>There is a subtle bug in the import structure of scipy which nearly drove me
>crazy.
>
>Here is how to reproduce it:
>
>====
>import scipy
>====
>
>imports and executes any file named "new.py" in the current working
>directory. 
>
>Python 2.3.3 (#1, Apr  6 2004, 01:47:39) 
>[GCC 3.3.3 (SuSE Linux)] on linux2
>
>scipy.__version__
>'0.3.1_285.4270'
>
>  
>
I think this 'bug' will happen anytime you name a file using a Python 
module name that another module is expecting.    Your  new.py file is 
over-riding the Python module new here that parts of scipy depends on.

Try naming a file re.py in your current directory and you will get 
similar problems.  

-Travis




More information about the SciPy-Dev mailing list