imported module scitools not recognized

M

mgdevos

Hi all,


I have installed the scitools module but modules included in scitools,
for example numpyutils, are not recognized.
Python is able to import scitools, and scitools is recognized in my
editor (Pydev for Eclipse 1.4.4) as autocompletion works well.
However, when I try to run a test script:

import scitools
print "Sequence is: ",scitools.numpyutils.seq(0,10,1)

I get an error: "AttributeError: 'module' object has no attribute
'numpyutils'"

I assume that installation of scitools ( version 0.4 using the windows
installer) was succesful as scitools is added to my python libs: D:
\Programs\python_enthought2.5.2001\Lib\site-packages\scitools
I added the path to scitools to my pthonpath and even added all three
modules to forced-builtins, but still I get the same error message.

Could you please help me solving this problem?


Martine
 
R

Robert Kern

Hi all,


I have installed the scitools module but modules included in scitools,
for example numpyutils, are not recognized.
Python is able to import scitools, and scitools is recognized in my
editor (Pydev for Eclipse 1.4.4) as autocompletion works well.
However, when I try to run a test script:

import scitools
print "Sequence is: ",scitools.numpyutils.seq(0,10,1)

I get an error: "AttributeError: 'module' object has no attribute
'numpyutils'"

I assume that installation of scitools ( version 0.4 using the windows
installer) was succesful as scitools is added to my python libs: D:
\Programs\python_enthought2.5.2001\Lib\site-packages\scitools
I added the path to scitools to my pthonpath and even added all three
modules to forced-builtins, but still I get the same error message.

Could you please help me solving this problem?

from scitools import numpyutils
print 'Sequence is: ', numpyutils.seq(0,10,1)

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
 
T

Terry Reedy

scitools is a package (on disk, a directory). When you import it as a
module, the module object is created by executing scitools.__init__.py.
If that file is empty, so will be the module created from it. Try
print(dir(scitools)) to see.

In fact, I suspect scitools has no attributes other that the default
module attributes.

You can always check the scitools directory to see that it has the
contents you expect. In particular, you can look at its __init__.py
file to see what it will have on import.
from scitools import numpyutils
print 'Sequence is: ', numpyutils.seq(0,10,1)

I believe you could also do

import scitools.numpyutils
print "Sequence is: ",scitools.numpyutils.seq(0,10,1)

but it is usually more convenient to do the 'import from' so you do not
have to repeat the full dotted name sequence.

Terry Jan Reedy
 
M

martine de vos

Thanks for your help and explanation.
I am now able to use modules from scitools.

Martine
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top