dev_appserver.py在启动时失败

时间:2017-07-03 07:12:55

标签: python google-app-engine google-cloud-sdk

使用dev_appserver.py启动本地开发服务器时,出现以下错误。

$ dev_appserver.py app.yaml
INFO     2017-07-03 06:51:09,662 devappserver2.py:116] Skipping SDK update check.
Traceback (most recent call last):
  File "/home/daniel/google-cloud-sdk/platform/google_appengine/dev_appserver.py", line 103, in <module>
    _run_file(__file__, globals())
  File "/home/daniel/google-cloud-sdk/platform/google_appengine/dev_appserver.py", line 97, in _run_file
    execfile(_PATHS.script_file(script_name), globals_)
  File "/home/daniel/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 381, in <module>
    main()
  File "/home/daniel/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 369, in main
    dev_server.start(options)
  File "/home/daniel/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 176, in start
    configuration.modules[0].application_root, datastore_emulator_host)
  File "/home/daniel/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/api_server.py", line 524, in create_api_server
    appidentity_oauth_url=options.appidentity_oauth_url)
  File "/home/daniel/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/api_server.py", line 699, in setup_stubs
    oauth_url=appidentity_oauth_url)
  File "/home/daniel/google-cloud-sdk/platform/google_appengine/google/appengine/api/app_identity/app_identity_stub.py", line 198, in Create
    import six
  File "/home/daniel/google-cloud-sdk/platform/google_appengine/lib/six-1.9.0/six/__init__.py", line 825, in <module>
    from . import test_six
  File "/home/daniel/google-cloud-sdk/platform/google_appengine/lib/six-1.9.0/six/test_six.py", line 105, in <module>
    @py.test.mark.parametrize("item_name",
AttributeError: 'NoneType' object has no attribute 'parametrize'

版本:

$ gcloud --version
Google Cloud SDK 161.0.0
app-engine-python 1.9.55
beta 2017.03.24
bq 2.0.24
core 2017.06.26
gcloud 
gsutil 4.26

2 个答案:

答案 0 :(得分:5)

gcloud-sdk组件app-engine-python==1.9.55已托管的six==1.9.0库似乎依赖于pytest

通过安装pytest

修复了问题
$ pip install pytest

请参阅问题:https://issuetracker.google.com/issues/62980070

答案 1 :(得分:3)

对于拥有pytest版本&lt;的用户来说,这应该只是一个问题。 2.2.0本地安装,当前版本为3.1.3。如果(a)他们没有安装pytest或(b)安装了pytest&gt; = 2.2.0,用户将不会看到此问题。堆栈跟踪末尾的@ py.test.mark.parametrize()装饰器在2.2.0中引入。

我们已经为pytest&lt;的用户提交了一个解决此问题的补丁。 2.2.0将在下一个App Engine SDK版本中提供。与此同时,用户可以在本地升级他们的pytest版本,问题应该消失。