Nose GAE:无法导入dev_appserver,但app引擎仍处于PYTHONPATH状态

时间:2014-12-07 15:12:59

标签: google-app-engine nose nosetests

尝试从我的GAE项目中运行nosetest时出现以下错误:

nosetests --nologcapture --with-gae --without-sandbox --gae-lib-root=/Users/dsinha/Dropbox/code/google-cloud-sdk/platform/google_appengine

但是我收到以下错误:

Traceback (most recent call last):
  File "/usr/local/bin/nosetests", line 8, in <module>
    load_entry_point('nose==1.3.4', 'console_scripts', 'nosetests')()
  File "/Library/Python/2.7/site-packages/nose/core.py", line 121, in __init__
    **extra_args)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/main.py", line 94, in __init__
    self.parseArgs(argv)
  File "/Library/Python/2.7/site-packages/nose/core.py", line 145, in parseArgs
    self.config.configure(argv, doc=self.usage())
  File "/Library/Python/2.7/site-packages/nose/config.py", line 346, in configure
    self.plugins.configure(options, self)
  File "/Library/Python/2.7/site-packages/nose/plugins/manager.py", line 284, in configure
    cfg(options, config)
  File "/Library/Python/2.7/site-packages/nose/plugins/manager.py", line 99, in __call__
    return self.call(*arg, **kw)
  File "/Library/Python/2.7/site-packages/nose/plugins/manager.py", line 167, in simple
    result = meth(*arg, **kw)
  File "/Library/Python/2.7/site-packages/nosegae.py", line 87, in configure
    from google.appengine.tools import old_dev_appserver as dev_appserver
ImportError: cannot import name old_dev_appserver

sys.path读取:

&#39; /Users/dsinha/Downloads/eclipse/plugins/org.python.pydev_3.9.0.201411111611/pysrc' ;,&#39; / Users / dsinha / Dropbox / code / google-cloud- sdk / platform / google_appengine / lib / antlr3&#39;,&#39; / Users / dsinha / Dropbox / code / google-cloud-sdk / platform / google_appengine / lib / fancy_urllib&#39;,&#39; / Users / dsinha / Dropbox / code / google-cloud-sdk / platform / google_appengine / lib / ipaddr&#39;,&#39; / Users / dsinha / Dropbox / code / google-cloud-sdk / platform / google_appengine / lib / yaml- 3.10&#39;,&#39; / Users / dsinha / Dropbox / code / google-cloud-sdk / platform / google_appengine / lib / rsa&#39;,&#39; / Users / dsinha / Dropbox / code / google -cloud-sdk / platform / google_appengine / lib / pyasn1&#39;,&#39; / Users / dsinha / Dropbox / code / google-cloud-sdk / platform / google_appengine / lib / pyasn1_modules&#39;,&#39; / Users / dsinha / Dropbox / code / google-cloud-sdk / platform / google_appengine&#39;,&#39; / Users / dsinha / Dropbox / code / google-cloud-sdk / platform / google_appengine / lib / simplejson&#39 ;,&#39; / Users / dsinha / Dropbox / code / google-cloud-sdk / platform / google_appe ngine / lib / django-1.4&#39;,&#39; / Users / dsinha / Dropbox / code / google-cloud-sdk / platform / goo ...

因此应该引入应用程序引擎库。实际上它首先未能拉入dev_appserver,然后尝试并且无法拉出old_dev_appserver

appengine / lib文件中的目录是:

bash-3.2$ ls
__init__.py                     appcfg.py                       backends_xml_parser.py          dispatch_xml_parser.py          handler_generator.py            php_cli.py                      value_mixin.pyc
__init__.pyc                    appcfg_java.py                  boolean_action.py               docker                          handler_generator.pyc           queue_xml_parser.py             web_xml_parser.py
adaptive_thread_pool.py         appengine_rpc.py                boolean_action.pyc              dos_xml_parser.py               jarfile.py                      queue_xml_parser.pyc            web_xml_parser.pyc
api_server.py                   appengine_rpc.pyc               bulkload_client.py              download_appstats.py            java_quickstart.py              remote_api_shell.py             xml_parser_utils.py
app_engine_config_exception.py  appengine_rpc_httplib2.py       bulkloader.py                   endpointscfg.py                 java_quickstart.pyc             requeue.py                      xml_parser_utils.pyc
app_engine_config_exception.pyc augment_mimetypes.py            cron_xml_parser.py              gen_protorpc.py                 java_utils.py                   sdk_update_checker.py           yaml_translator.py
app_engine_web_xml_parser.py    augment_mimetypes.pyc           dev-channel-js.js               handler.py                      java_utils.pyc                  sdk_update_checker.pyc          yaml_translator.pyc
app_engine_web_xml_parser.pyc   backends_conversion.py          devappserver2                   handler.pyc                     os_compat.py                    value_mixin.py
bash-3.2$ pwd
/Users/dsinha/Dropbox/code/google-cloud-sdk/platform/google_appengine/google/appengine/tools

我还尝试在google.appengine.tools包中找到可用的模块:

>>> import pkgutil
>>> [name for _, name, _ in pkgutil.iter_modules(['testpkg'])]
[]

此问题在我升级到App Engine 1.9.10(使用异步搜索功能)后开始出现。在我认为相关的问题中,当我尝试从PyDev运行调试服务器时,它只是在任何页面请求(localhost:8080)上静默终止。

从命令行运行dev_appserver .可以正常工作。

1 个答案:

答案 0 :(得分:0)

Nose-GAE打破App Engine 1.9.17:https://github.com/Trii/NoseGAE/issues/6 降级至1.9.15使得问题在等待问题得到解决时暂时消失