[mod_python] How to initialize a variable using PythonImport and access it from a Handler?

jarrod roberson jarrod.roberson at gmail.com
Mon May 2 14:34:54 EDT 2005


I am trying to get access to a list that is being updated by a Twisted Reactor.
I do a PythonIport myapp main_interpreter in httpd.conf
I have a handler that I want to print out the contents of list
returned from a function on the global object, but I get this error

Any ideas . . .

Mod_python error: "PythonHandler viewZeroConf"

Traceback (most recent call last):

  File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/mod_python/apache.py",
line 287, in HandlerDispatch
    log=debug)

  File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/mod_python/apache.py",
line 457, in import_module
    module = imp.load_module(mname, f, p, d)

  File "/www/viewZeroConf.py", line 2, in ?
    import myapp

  File "/www/weblife/__init__.py", line 7, in ?
    from twisted.internet import reactor

  File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/twisted/internet/reactor.py",
line 11, in ?
    from twisted.internet import selectreactor

  File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/twisted/internet/selectreactor.py",
line 22, in ?
    from twisted.internet import posixbase

  File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/twisted/internet/posixbase.py",
line 25, in ?
    from twisted.internet import tcp, udp

  File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/twisted/internet/tcp.py",
line 65, in ?
    from twisted.internet import protocol, defer, base, address

  File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/twisted/internet/protocol.py",
line 25, in ?
    class Factory:

  File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/zope/interface/advice.py",
line 132, in advise
    return callback(newClass)

  File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/zope/interface/declarations.py",
line 550, in _implements_advice
    classImplements(cls, *interfaces)

  File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/zope/interface/declarations.py",
line 526, in classImplements
    spec = implementedBy(cls)

  File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/zope/interface/declarations.py",
line 364, in implementedByFallback
    spec = cls.__dict__.get('__implemented__')

RuntimeError: class.__dict__ not accessible in restricted mode
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20050502/9a03a379/attachment.html


More information about the Mod_python mailing list