gae错误:AttributeError

时间:2014-11-30 06:17:09

标签: php python google-app-engine

当我尝试部署时。 GAE让我出现以下错误:

Traceback (most recent call last):
  File "C:\Projects\appcfg.py", line 127, in <module>
    run_file(__file__, globals())
  File "C:\Projects\appcfg.py", line 123, in run_file
    execfile(_PATHS.script_file(script_name), globals_)
  File "C:\Projects\google\appengine\tools\appcfg.py", line 5401, in <module>
    main(sys.argv)
  File "C:\Projects\google\appengine\tools\appcfg.py", line 5392, in main
    result = AppCfgApp(argv).Run()
  File "C:\Projects\google\appengine\tools\appcfg.py", line 2864, in __init__
    action.options(self, self.parser)
  File "C:\Projects\google\appengine\tools\appcfg.py", line 3926, in _UpdateOptions
    if JavaSupported():
  File "C:\Projects\google\appengine\tools\appcfg.py", line 250, in JavaSupported
    tools_java_dir = os.path.join(os.path.dirname(appcfg_java.__file__), 'java')
AttributeError: 'NoneType' object has no attribute '__file__'
2014-11-30 11:39:45 (Process exited with code 1)

请帮我解决..(PS:这是一个PHP部署)

更新 我的app.yaml内容被问到,我之前已经上传了类似的app.yaml它已经有效..

application: project-name
version: 1
runtime: php
api_version: 1
threadsafe: yes

handlers:
- url: /favicon\.ico
  static_files: favicon.ico
  upload: favicon\.ico

- url: /
  script: index.php

- url: /main.js
  script: main.js

- url: /static
  static_dir: static

1 个答案:

答案 0 :(得分:0)

在早于2.7的Python版本上运行时,appcfg中存在一个错误。如果您不能轻易更新到2.7,则可以修补appcfg.py(路径显示在堆栈跟踪中)。您获得例外的行是这一行:

tools_java_dir = os.path.join(os.path.dirname(appcfg_java.__file__), 'java')

您可以将其更改为在此之前插入此行:

if not appcfg_java: return False

因为这是Python,所以你需要注意缩进。新行应与此处显示的现有行具有完全相同的缩进。