10

https://developers.google.com/appengine/docs/python/gettingstartedpython27/introductionのチュートリアルに従っています

私の app.yaml は次のとおりです。

application: myapp
version: 1
runtime: python27
api_version: 1
threadsafe: true

handlers:
- url: /
  script: helloworld.application

helloworld.py は次のとおりです。

import webapp2


class MainPage(webapp2.RequestHandler):

    def get(self):
        self.response.headers['Content-Type'] = 'text/plain'
        self.response.write('Hi')


application = webapp2.WSGIApplication([
    ('/', MainPage),
], debug=True)

ログ出力は次のとおりです。

*** Running dev_appserver with the following flags:
    --skip_sdk_update_check=yes --port=10090 --admin_port=8001
Python command: /usr/bin/python2.7
Traceback (most recent call last):
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/dev_appserver.py", line 182, in <module>
    _run_file(__file__, globals())
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/dev_appserver.py", line 178, in _run_file
    execfile(script_path, globals_)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 695, in <module>
    main()
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 688, in main
    dev_server.start(options)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 525, in start
    options.yaml_files)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/application_configuration.py", line 556, in __init__
    server_configuration = ServerConfiguration(yaml_path)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/application_configuration.py", line 82, in __init__
    self._yaml_path)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/application_configuration.py", line 272, in _parse_configuration
    return appinfo_includes.ParseAndReturnIncludePaths(f)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api/appinfo_includes.py", line 63, in ParseAndReturnIncludePaths
    appyaml = appinfo.LoadSingleAppInfo(appinfo_file)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api/appinfo.py", line 1715, in LoadSingleAppInfo
    listener.Parse(app_info)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api/yaml_listener.py", line 226, in Parse
    self._HandleEvents(self._GenerateEventParameters(stream, loader_class))
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api/yaml_listener.py", line 177, in _HandleEvents
    raise yaml_errors.EventError(e, event_object)
google.appengine.api.yaml_errors.EventError

私はpython 2.7を使用してmacbook proで実行しています.appエンジンランチャーを使用しています。何か案は?

4

5 に答える 5

10

私も同じ問題を経験しました。サイトから直接コピーする場合、ファイルのエンコードに関係があります。これを避け、ファイルに適切な yaml エンコーディングがあることを確認してください。app.yaml ファイルの使用を開始するための例を次に示します。

application: your-app-id
version: 1
runtime: python27
api_version: 1
threadsafe: true

handlers:
- url: /.*
  script: helloworld.application
于 2013-07-11T13:58:18.293 に答える
8

私の場合、問題は「スクリプト」行のインデントレベルでした。

それは次のようでした:

handlers:
 - url: /.*
 script: helloworld.php

しかし、次のようにする必要があります:

handlers:
 - url: /.*
   script: helloworld.php
于 2013-11-02T15:05:39.540 に答える
1

app.yaml のアプリケーション行の前にある特殊文字を削除してみてください。そこにはないようですが、カーソルを前の位置に移動し、バックスペースを押して削除してください。

于 2013-08-28T07:51:09.323 に答える
0

@Fernando Bassoの回答を完了するには、スクリプト行の正しい意図は2つのスペースである必要がありますが、エラーを生成する \t 文字として読み取られるため、タブではありません。

于 2015-01-05T04:24:43.087 に答える