I am trying to use a python module (nltk) in web2py.
I am able to use the module from the python command line without issues. In Web2py I get the error below.
Thanks!
import nltk
from nltk.corpus import wordnet as wn
def get_thes():
wn.synset('car.n.01').lemma_names
return dict()
web2py™ Version 2.5.1-stable+timestamp.2013.06.06.15.39.19
Python Python 2.7.3: /usr/bin/python (prefix: /usr)
Traceback (most recent call last):
File "/home/www-data/web2py/gluon/restricted.py", line 212, in restricted
exec ccode in environment
File "/home/www-data/web2py/applications/Wordgf/controllers/thes.py", line 1, in <module>
import nltk
File "/home/www-data/web2py/gluon/custom_import.py", line 95, in custom_importer
raise e2 # there is an error in the module
AttributeError: 'module' object has no attribute 'error'
Only the source version of web2py is able to import modules.
Make sure you are not using a compiled version.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.