Robert Kern wrote:
On 2009-03-26 10:42, mgdevos wrote:
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

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.

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

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

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

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

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.

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)

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




--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to