Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mapping values are not allowed here ... in foo.py

I have this GAE python code

In file foo.py

import webapp2

class MainPage(webapp2.RequestHandler):

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

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

in file app.yaml

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

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

I get this error pointing to the third line in file foo.py ( class MainPage(webapp2.RequestHandler): ) Obs. Begin reading from the end of the message

...
line 172, in _HandleEvents
    for event in events:
  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 "foo.py", line 3, column 39

I would appreciate a good help

thanks Sam

like image 386
riemaxi Avatar asked Apr 19 '13 11:04

riemaxi


1 Answers

This kind of error occurs if you start the application the wrong way: dev_appserver.py foo.py. You need a directory, e.g., foo with foo/foo.py and foo/app.yaml and then start the program from the parent directory with dev_appserver.py foo/ or in the directory itself with dev_appserver.py .

like image 102
Finn Årup Nielsen Avatar answered Oct 18 '22 17:10

Finn Årup Nielsen