[Tutor] How does import work?
Johan Nilsson
johan.nilsson at freenet.de
Fri Jan 28 18:40:53 CET 2005
Hi all,
I am rather new to python. I am trying to write a program using the
scipy package. I have come across a problem that confuses me, and I hope
that someone could give me an hint on how to solve this.
Here is what I do
Start idle
>>> from scipy.signal.signaltools import *
/Traceback (most recent call last):
File "<pyshell#0>", line 1, in -toplevel-
from scipy.signal.signaltools import *
ImportError: No module named signaltools/
So I try the methodic way and this works, giving me access to the
functions I need
>>> from scipy import *
>>> from scipy.signal import *
>>> from scipy.signal.signaltools import *
Now what confuses me is that when I put the above three lines in a file
(of course without the >>>) and execute them I get a long error message.
/ Traceback (most recent call last):
File "/home/johan/pyton/import_test.py", line 5, in -toplevel-
from scipy.signal import *
File "/usr/local/lib/python2.3/site-packages/scipy_base/ppimport.py",
line 270, in __getattr__
module = self._ppimport_importer()
File "/usr/local/lib/python2.3/site-packages/scipy_base/ppimport.py",
line 233, in _ppimport_importer
raise PPImportError,\
PPImportError: Traceback (most recent call last):
File "/usr/local/lib/python2.3/site-packages/scipy_base/ppimport.py",
line 243, in _ppimport_importer
module = __import__(name,None,None,['*'])
File "/usr/lib/python2.3/site-packages/scipy/signal/__init__.py", line
11, in ?
File "/usr/lib/python2.3/site-packages/scipy/signal/ltisys.py", line
14, in ?
File "/usr/local/lib/python2.3/site-packages/scipy_base/ppimport.py",
line 270, in __getattr__
module = self._ppimport_importer()
File "/usr/local/lib/python2.3/site-packages/scipy_base/ppimport.py",
line 233, in _ppimport_importer
raise PPImportError,\
PPImportError: Traceback (most recent call last):
File "/usr/local/lib/python2.3/site-packages/scipy_base/ppimport.py",
line 243, in _ppimport_importer
module = __import__(name,None,None,['*'])
File "/usr/lib/python2.3/site-packages/Numeric/Matrix.py", line 5, in ?
import LinearAlgebra
File
"/usr/local/lib/python2.3/site-packages/Numeric/LinearAlgebra.py", line
8, in ?
import lapack_lite
ImportError:
/usr/local/lib/python2.3/site-packages/Numeric/lapack_lite.so: undefined
symbol: dgesdd_/
What I dont understand is how can the import statements work, when I
type them in manually in IDLE and not when I execute them in a file? Has
anyone come across this type of behavior before?
Johan
More information about the Tutor
mailing list