[mod_python] problem importing numarray

Patrik Jonsson patrik at ucolick.org
Mon Oct 24 22:56:05 EDT 2005


hi,

I just started playing with mod_python and I have a problem importing
the numarray module. it works fine from the command line, but not when
executed through mod_python.  I have the Publisher handler and a very
basic script:

"
import numarray
"

This gives the following output:

Mod_python error: "PythonHandler mod_python.publisher"

Traceback (most recent call last):

  File "/usr/lib64/python2.4/site-packages/mod_python/apache.py", line
299, in HandlerDispatch
    result = object(req)

  File "/usr/lib64/python2.4/site-packages/mod_python/publisher.py",
line 98, in handler
    path=[path])

  File "/usr/lib64/python2.4/site-packages/mod_python/apache.py", line
457, in import_module
    module = imp.load_module(mname, f, p, d)

  File "/home/www/patrik/simulations/junk.py", line 1, in ?
    import numarray

  File "/usr/lib64/python2.4/site-packages/numarray/__init__.py", line
42, in ?
    from numarrayall import *

  File "/usr/lib64/python2.4/site-packages/numarray/numarrayall.py",
line 1, in ?
    from numerictypes import *

  File "/usr/lib64/python2.4/site-packages/numarray/numerictypes.py",
line 390, in ?
    from codegenerator.ufunccode import typecode

  File
"/usr/lib64/python2.4/site-packages/numarray/codegenerator/__init__.py",
line 1, in ?
    from basecode import all_types

  File
"/usr/lib64/python2.4/site-packages/numarray/codegenerator/basecode.py",
line 20, in ?
    if hasUInt64():

  File
"/usr/lib64/python2.4/site-packages/numarray/codegenerator/basecode.py",
line 11, in hasUInt64
    return "--hasUInt64" in sys.argv

AttributeError: 'module' object has no attribute 'argv'




This looks like sys.argv doesn't exist from within mod_python?  I agree
this information probably isn't useful in this context, but since all
documentation I've seen says that sys.argv is defined, it seems bad to
break existing software that relies on its existence. Shouldn't it just
be [''] like it is when you run the interpreter from the command line?

Incidentally, if I reload the page, I get instead:

Mod_python error: "PythonHandler mod_python.publisher"

Traceback (most recent call last):

  File "/usr/lib64/python2.4/site-packages/mod_python/apache.py", line
299, in HandlerDispatch
    result = object(req)

  File "/usr/lib64/python2.4/site-packages/mod_python/publisher.py",
line 98, in handler
    path=[path])

  File "/usr/lib64/python2.4/site-packages/mod_python/apache.py", line
457, in import_module
    module = imp.load_module(mname, f, p, d)

  File "/home/www/patrik/simulations/junk.py", line 1, in ?
    import numarray

  File "/usr/lib64/python2.4/site-packages/numarray/__init__.py", line
42, in ?
    from numarrayall import *

  File "/usr/lib64/python2.4/site-packages/numarray/numarrayall.py",
line 1, in ?
    from numerictypes import *

  File "/usr/lib64/python2.4/site-packages/numarray/numerictypes.py",
line 168, in ?
    Byte = _register("Byte",   Int8)

  File "/usr/lib64/python2.4/site-packages/numarray/numerictypes.py",
line 68, in _register
    raise ValueError("Type %s has already been registered" % name)

ValueError: Type Byte has already been registered



If anyone has any ideas on how to fix this, I'd much appreciate it!

Thanks,

/Patrik
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20051024/741fa53f/signature.bin


More information about the Mod_python mailing list