0
votes

I create a basic hello world program , when I run I am getting error as "google.appengine.api.yaml_errors.EventListenerYAMLError: mapping values are not allowed here"

I checked the space , intentation etc in yaml file . . The command I executed is " python google-cloud-sdk\bin\dev_appserver.py C:\Sachin\appengine\testpgm\helloworld.py " I have python2.7 installed . Is this kind of error installation issue or my code.

For testing when I deleted my app.yaml , still I am getting the same error. So get confused , whther it is an installation or some thing else

My program

import webapp2
class MainPage(webapp2.RequestHandler):
    def get(self):
        self.response.headers['Content-Type'] = 'text/plain'
        self.response.out.write('Hello, webapp2 World!')

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

app.yaml

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

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

Error

C:\Google\Cloud SDK>python google-cloud-sdk\bin\dev_appserver.py C:\Sachin\appengine\testpgm\helloworld.py
Traceback (most recent call last):
  File "C:\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\dev_appserver.py", line 96, in <module>
    _run_file(__file__, globals())
  File "C:\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\dev_appserver.py", line 90, in _run_file
    execfile(_PATHS.script_file(script_name), globals_)
  File "C:\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\tools\devappserver2\devappserver2.py", line 613, in <module>
    main()
  File "C:\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\tools\devappserver2\devappserver2.py", line 601, in main
    dev_server.start(options)
  File "C:\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\tools\devappserver2\devappserver2.py", line 277, in start
    env_variables=parsed_env_variables)
  File "C:\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\tools\devappserver2\application_configuration.py", line 940, in __init__
    env_variables)
  File "C:\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\tools\devappserver2\application_configuration.py", line 139, in __init__
    self._config_path)
  File "C:\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\tools\devappserver2\application_configuration.py", line 502, in _parse_configuration
    config, files = appinfo_includes.ParseAndReturnIncludePaths(f)
  File "C:\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\api\appinfo_includes.py", line 82, in ParseAndReturnIncludePaths
    appyaml = appinfo.LoadSingleAppInfo(appinfo_file)
  File "C:\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\api\appinfo.py", line 2688, in LoadSingleAppInfo
    listener.Parse(app_info)
  File "C:\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\api\yaml_listener.py", line 240, in Parse
    stream, loader_class, version=version, **loader_args))
  File "C:\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\api\yaml_listener.py", line 173, in _HandleEvents
    for event in events:
  File "C:\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\api\yaml_listener.py", line 217, in _GenerateEventParameters
    raise yaml_errors.EventListenerYAMLError(e)
google.appengine.api.yaml_errors.EventListenerYAMLError: mapping values are not allowed here
  in "C:\Sachin\appengine\testpgm\helloworld.py", line 3, column 39
2

2 Answers

1
votes

The application element from your YAML is deprecated and shouldn't be used. The documentation also states it.

You should remove it and judging by the key-value pair you were specifying, I think you wanted to use service instead, further information is shown here.

1
votes

This issue was in my execution command. I gave the programe name as well. We should give up to the folder where our source resides. I should give only python google-cloud-sdk\bin\dev_appserver.py C:\Sachin\appengine\testpgm