Python 谷歌应用程序引擎:模块没有属性应用程序。。。但是属性app在那里(由/_ah/start调用)

Python 谷歌应用程序引擎:模块没有属性应用程序。。。但是属性app在那里(由/_ah/start调用),python,google-app-engine,webapp2,Python,Google App Engine,Webapp2,parser.yaml application: xyz module: parser version: 'v1' runtime: python27 api_version: '1' threadsafe: yes instance_class: B2 basic_scaling: max_instances: 1 idle_timeout: 10m handlers: - url: /.* script: parser.app libraries: - name: weba

parser.yaml

application: xyz
module: parser
version: 'v1'
runtime: python27
api_version: '1'
threadsafe: yes

instance_class: B2
basic_scaling:
  max_instances: 1
  idle_timeout: 10m

handlers:
- url: /.*
  script: parser.app

libraries:
- name: webapp2
  version: "2.5.2"
parser.py

import webapp2
class ParseHandler(webapp2.RequestHandler):
    def get(self):
        self.response.out.write("ok")

app = webapp2.WSGIApplication([
    ('/init', ParseHandler)
], debug=True)
谷歌应用引擎请求/_ah/start返回错误(代码500):

“GET/\u ah/start HTTP/1.1”500 0--“0.v1.parser.xyz.appspot.com”ms=332 cpu\u ms=27加载\u请求=1退出\u代码=111实例=0应用程序\u引擎\u发布=1.8.9
回溯(最近一次呼叫最后一次):
文件“/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py”,第239行,在Handle中
handler=\u config\u handle.add\u wsgi\u中间件(self.\u LoadHandler())
文件“/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py”,第301行,在_LoadHandler中
提出错误
ImportError:没有属性app
此请求导致为应用程序启动一个新进程,从而导致首次加载应用程序代码。因此,与应用程序的典型请求相比,此请求可能需要更长的时间并使用更多的CPU。
进程终止,因为它无法响应HTTP状态代码为200-299或404的启动请求。
但是parser.py具有必需的app属性。有什么问题


我尝试为/_ah/start添加一个专用路由,并在parser.py中为其附加一个处理程序,但这并不能解决导入问题。

应用程序引擎似乎找到了一个内置的解析器模块;一个C库


尝试将模块从
parser.py
重命名为其他名称。

为什么要使用
parser.yaml
?我以前从未见过——在我所做的每件事中,它都是
app.yaml
Parser是一个模块。应用程序引擎似乎找到了一个内置的
解析器
模块;一个C库。尝试将模块从
parser.py
重命名为其他名称。@mattes--很好。我以前没见过。@martijn pieters:太棒了!成功了!非常感谢你!您可能想重新发布您的评论作为答案,这样我就可以“接受它作为答案”。
"GET /_ah/start HTTP/1.1" 500 0 - - "0.v1.parser.xyz.appspot.com" ms=332 cpu_ms=27 loading_request=1 exit_code=111 instance=0 app_engine_release=1.8.9 

Traceback (most recent call last):
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 239, in Handle
    handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 301, in _LoadHandler
    raise err
ImportError: <module 'parser' (built-in)> has no attribute app

This request caused a new process to be started for your application, and thus caused your application code to be loaded for the first time. This request may thus take longer and use more CPU than a typical request for your application.

Process terminated because it failed to respond to the start request with an HTTP status code of 200-299 or 404.