[Python] scipy code runs in empty directory, not another

Chris Gonnerman chris.gonnerman at newcenturycomputers.net
Sat Nov 13 15:12:05 CET 2010


On 11/13/2010 07:52 AM, Beliavsky wrote:
> After installing numpy, scipy, and matplotlib for python 2.6 and
> running the code from http://www.scipy.org/Cookbook/OptimizationDemo1
> (stored as xoptimize.py) in a directory with other python codes, I got
> the error messages
>
> C:\python\code\mycode>python xoptimize.py
> Traceback (most recent call last):
>    File "xoptimize.py", line 3, in<module>
>      from pylab import *
>    File "c:\python26\lib\site-packages\pylab.py", line 1, in<module>
>      from matplotlib.pylab import *
>    File "c:\python26\lib\site-packages\matplotlib\__init__.py", line
> 133, in<module>
>      import sys, os, tempfile
>    File "c:\python26\lib\tempfile.py", line 34, in<module>
>      from random import Random as _Random
>    File "C:\python\code\mycode\random.py", line 1, in<module>
>      from RandomArray import standard_normal
>    File "C:\python\code\mycode\RandomArray.py", line 1, in<module>
>      import ranlib
> ImportError: No module named ranlib
>
> When I create a new directory, copy xoptimize.py there, and run, the
> program works. Can someone explain why other files are "interfering"
> in the first case? Thanks.
You'd need to post a list of the files in the directory before we'd have 
any idea why this is happening.

-- Chris.




More information about the Python-list mailing list