FAQ
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

Search Discussions

  • Robert Kern at Mar 26, 2009 at 7:11 pm

    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
    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
  • Terry Reedy at Mar 26, 2009 at 8:39 pm

    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
  • Martine de vos at Mar 27, 2009 at 1:43 pm
    Thanks for your help and explanation.
    I am now able to use modules from scitools.

    Martine
    On 26 mrt, 21:39, Terry Reedy 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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedMar 26, '09 at 3:42p
activeMar 27, '09 at 1:43p
posts4
users3
websitepython.org

People

Translate

site design / logo © 2022 Grokbase