imported module scitools not recognized

martine de vos mgdevos at gmail.com
Fri Mar 27 09:43:39 EDT 2009


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

Martine

On 26 mrt, 21:39, Terry Reedy <tjre... at udel.edu> wrote:
> Robert Kern wrote:
> > On 2009-03-26 10:42, mgdevos wrote:
> >> Hi all,
>
> >> I have installed thescitoolsmodule but modules included inscitools,
> >> for example numpyutils, are not recognized.
> >> Python is able to importscitools, andscitoolsis recognized in my
> >> editor (Pydev for Eclipse 1.4.4) as autocompletion works well.
> >> However, when I try to run a test script:
>
> >> importscitools
>
> scitoolsis a package (on disk, a directory).  When you import it as a
> module, the module object is created by executingscitools.__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 suspectscitoolshas no attributes other that the default
> module attributes.
>
> >> I assume that installation ofscitools( version 0.4 using the windows
> >> installer) was succesful asscitoolsis added to my python libs: D:
> >> \Programs\python_enthought2.5.2001\Lib\site-packages\scitools
>
> You can always check thescitoolsdirectory 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 toscitoolsto 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?
>
> > fromscitoolsimport numpyutils
> > print 'Sequence is: ', numpyutils.seq(0,10,1)
>
> I believe you could also do
>
> importscitools.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




More information about the Python-list mailing list