[Tutor] How does import work?

Michael Janssen mi.janssen at gmail.com
Tue Feb 1 13:40:36 CET 2005

On Fri, 28 Jan 2005 18:40:53 +0100, Johan Nilsson
<johan.nilsson at freenet.de> wrote:

>  >>> 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 *

seems like overkill (and I don't understand why it works better than
the above, but that's more an issue about my understanding and not
about python ;-). Try

from scipy.signal import signaltools # don't import everything from signal

and go on using functions from signaltools like this: signaltools.function

> 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.

perhaps different python versions?

> / Traceback (most recent call last):
>   File "/home/johan/pyton/import_test.py", line 5, in -toplevel-
>     from scipy.signal import *

note that the error occours while importing everything from
scipy.signal . The chance are well that this error goes away when
using a reduced import statement.

[snip long traceback talking about scipy and Numerics imports]

>     import lapack_lite
> ImportError:
> /usr/local/lib/python2.3/site-packages/Numeric/lapack_lite.so: undefined
> symbol: dgesdd_/

given the fact that I'm no c-programmer this seems to me like a broken
c module. I would try to reinstall Numeric/ scipy (After hunting the
problem down to a specific import).

The most obvious reason why the import in idle works is that idle uses
another version of python (ask sys.version)


More information about the Tutor mailing list