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", line 204, in restricted
exec ccode in environment
File "/var/www/web2py/applications/welcome/controllers/default.py"
<https://ss-geospatial-hf/admin/default/edit/welcome/controllers/default.py>,
line 1, in <module>
from twisted.internet import reactor
File "/var/www/web2py/gluon/custom_import.py", line 293, in __call__
fromlist, level)
File "/var/www/web2py/gluon/custom_import.py", line 78, in __call__
level)
File "/usr/lib/python2.7/dist-packages/twisted/internet/reactor.py", line 37,
in <module>
from twisted.internet import default
File "/var/www/web2py/gluon/custom_import.py", line 271, in __call__
globals.get("__file__", ""))
File "/usr/lib/python2.7/posixpath.py", line 66, in join
if b.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.