我正在尝试在 web2py 中使用 python 模块(nltk)。
我可以毫无问题地从 python 命令行使用该模块。在 Web2py 中,我收到以下错误。
谢谢!
简单示例代码:
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'