[SciPy-user] 'crashing' python

Victor Reijs genietdev0 at iol.ie
Sun Jul 31 10:39:34 CDT 2005


Hello Brandon,

Brandon DuRette wrote:
> I think your confusion is probably with the word 'package'.  The code 
> 'from scipy import *' imports everything from the 'scipy' package.  But 
> that's not 'all of scipy'.  Scipy has subpackages, such as optimize, 
> that are not imported as part of the main scipy package.  For more on 
> Python packages, check here:
> 
> http://www.python.org/doc/current/tut/node8.html#SECTION008400000000000000000 

Thanks for this explanation, I now understand it better!

>> Just to let you know, I am a novice to python, so perhaps I 
>> misunderstand the basics of it! 
> 
> No worries.  We were all novices at one point. ;-)

Thanks for this understanding.

> Ah...  I think I know what the problem is.  Rename scipy.py to something 
> else.  By naming it scipy.py, you have shadowed the scipy package (and 
> also the scipy.optimize subpackage).

You are right! I renamed my scipy.py to something else (scipytest.py)
and it indeed works now in IDLE. THANKS.

>> Aoso 'print sys.path' gives no results:
>> ">>> print sys.path
>>
>> Traceback (most recent call last):
>>   File "<pyshell#0>", line 1, in -toplevel-
>>     print sys.path
>> NameError: name 'sys' is not defined
>> >>> "
> 
> 
> Yeah.  I forgot to mention, you need to import sys first.  'import sys; 
> print sys.path'.  But that may be irrelevant at this point.

Thanks for this also, indeed now path is known.

My knowledge is growing, but it seems I still am not able to run the
scipytest.py (renamed for PSP to scipytest.PspScript). So I must be
doing something wrong...
I get the error:
"Executing RunScript
Traceback (most recent call last):
   File "C:\Documents and Settings\vreijs\My Documents\My PSP8
Files\Scripts-Trusted\scipytest.PspScript", line 1, in ?
     from scipy import *
ImportError: No module named scipy"

Perhaps I have my scipy packages wrongly loaded in PSP directory
structure...


All the best,


Victor




More information about the SciPy-user mailing list