Development Tip

yaml 파일 구문 분석 오류 : 여기에 매핑 값이 허용되지 않습니다.

yourdevel 2020. 12. 3. 20:44
반응형

yaml 파일 구문 분석 오류 : 여기에 매핑 값이 허용되지 않습니다.


Google App Engine에 앱을 업로드하고 싶습니다.

나는 이것을 얻는다

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 열은 버전 행에 해당합니다. 여기서 무엇이 잘못 되었습니까? Btw, 여기서 Ubuntu 12.04를 사용하고 있습니다.


변화

application:climate-change

...에

application: climate-change

콜론 뒤의 공백은 yaml에서 필수입니다. ( http://www.yaml.org/spec/1.2/spec.html#id2759963 참조 )


또 다른 원인은 잘못된 들여 쓰기로 잘못된 개체를 만들려고한다는 의미입니다. Kubernetes Ingress 정의에서 하나를 수정했습니다.

잘못된

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

옳은

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

또는 공백이 문제가되지 않는 경우 파일 이름이 아닌 상위 디렉토리 이름이 필요할 수 있습니다.

아니 $ 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

아마도 이것은 다른 사람에게 도움이 될 수 있지만 매핑의 RHS에 다음과 같이 따옴표를 묶지 않고 콜론이 포함되어있을 때이 오류가 발생했습니다.

someKey: another key: Change to make today: work out more

should be

someKey: another key: "Change to make today: work out more"

참고URL : https://stackoverflow.com/questions/10971621/error-parsing-yaml-file-mapping-values-are-not-allowed-here

반응형