I wonder if reactor is a reserved word in web2py. Could you try giving
it a different namespace?
from twisted import reactor as another_reactor
On 05/23/2012 06:07 AM, Hugh Barker wrote:
Hi,
I need to run some code that uses the Twisted library from within
web2py (listening to multicast events on the network, parsing the data
and then inserting it into the web2pt DB for integration into a webapp).
I get the following error upon importing Twisted. In the interests
of reproducibility, I added
from twisted.internet import reactor
to the first line of the default.py controller in the welcome app.
This is enough to trigger the bug:
Traceback(most recent call last):
File"/var/www/web2py/gluon/restricted.py",line204,inrestricted
execccodeinenvironment
File"/var/www/web2py/applications/welcome/controllers/default.py"
<https://ss-geospatial-hf/admin/default/edit/welcome/controllers/default.py>,line1,in<module>
fromtwisted.internetimportreactor
File"/var/www/web2py/gluon/custom_import.py",line293,in__call__
fromlist,level)
File"/var/www/web2py/gluon/custom_import.py",line78,in__call__
level)
File"/usr/lib/python2.7/dist-packages/twisted/internet/reactor.py",line37,in<module>
fromtwisted.internetimportdefault
File"/var/www/web2py/gluon/custom_import.py",line271,in__call__
globals.get("__file__",""))
File"/usr/lib/python2.7/posixpath.py",line66,injoin
ifb.startswith('/'):
AttributeError:'NoneType'object has no attribute'startswith'
Ubuntu 12.04, Python 2.7.3, Twisted 12.0, web2py 1.99.4
There's nothing wrong with my twisted install - running the code I want to run
within the web2py context as a standalone script works fine.
Any help much appreciated.
Cheers,
Hugh.