2012-06-10 61 views
35

我要上傳的應用程序,以谷歌應用程序引擎:錯誤解析YAML文件:映射值在此允許

我得到這個

Error parsing yaml file: 
mapping values are not allowed here 
    in "/home/antonio/Desktop/ATI/climate-change/app.yaml", line 2, column 8 

當運行

./appcfg.py update /home/antonio/Desktop/ATI/climate-change 

與此app.yaml文件:

application:climate-change 
version: 1 
runtime: python27 
api_version: 1 
threadsafe: true 

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

第2行,第8列對應版本行。這裏有什麼問題?順便說一句,我在這裏使用Ubuntu 12.04。

回答

5

或者,如果間距不是問題,則可能需要父目錄名稱而不是文件名。

$ dev_appserver helloapp.py
$ dev_appserver hello/

例如:

Johns-Mac:hello john$ dev_appserver.py helloworld.py 
Traceback (most recent call last): 
    File "/usr/local/bin/dev_appserver.py", line 82, in <module> 
    _run_file(__file__, globals()) 
... 
    File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api/yaml_listener.py", line 212, in _GenerateEventParameters 
    raise yaml_errors.EventListenerYAMLError(e) 
google.appengine.api.yaml_errors.EventListenerYAMLError: mapping values are not allowed here 
    in "helloworld.py", line 3, column 39 

對戰

Johns-Mac:hello john$ cd .. 
Johns-Mac:fbm john$ dev_appserver.py hello/ 
INFO  2014-09-15 11:44:27,828 api_server.py:171] Starting API server at: http://localhost:61049 
INFO  2014-09-15 11:44:27,831 dispatcher.py:183] Starting module "default" running at: http://localhost:8080 
1

也許這將幫助別人,但我已經看到了這個錯誤時的在RHS映射包含不包含引號的冒號,如:

someKey: 另一個關鍵:換作今天:制定出更

應該

someKey: 另一個關鍵:「換作今天:制定出更」

19

另一個原因是錯誤的這意味着試圖創造錯誤的對象。我只是一個固定在Kubernetes入口的定義:

錯誤

- path:/
    backend: 
     serviceName: <service_name> 
     servicePort: <port> 

正確

- path:/
    backend: 
    serviceName: <service_name> 
    servicePort: <port> 
+0

謝謝!這解決了我的問題:) – Ads20000

+0

@ Ads20000你可以upvote答案然後:) – lucian

+0

是的,這也是我的問題。這就是爲什麼蟒蛇是愚蠢的。空白不應該很重要。 –

0
application:climate-change 

改變它

application: climate-change 

Yaml解析在冒號後需要空格

相關問題