Google App Engine:模块没有属性应用...但属性应用程序存在(由/ _ah / start调用)

问题描述 投票:1回答:1

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)

Google App Engines请求/ _ah / start返回错误(代码500):

"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.

但是parser.py具有所需的app属性。 问题是什么?

我尝试为/ _ah / start添加一个专用路由,并在parser.py中为它添加了一个处理程序,但这并没有解决ImportError问题。

python google-app-engine webapp2
1个回答
3
投票

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

尝试将您的模块从parser.py重命名为其他内容。

© www.soinside.com 2019 - 2024. All rights reserved.