python - main.py throws "ImportError: No module named app" -


i have file in root dir of app called main.py. file contains code starts app:

app = webapp2.wsgiapplication(routes = routes, debug = true, config = config)  def main():   app.run()  if __name__ == '__main__':   main() 

i have, amongst others, in app.yaml:

- url: /.*   script: main.app 

after upgrading 1.6.6 sdk, following error:

error    2012-06-05 13:39:01,856 wsgi.py:189]  traceback (most recent call last): file "/users/jdoe/applications/googleappenginelauncher.app/contents/resources/googleappengine-default.bundle/contents/resources/google_appengine/google/appengine/runtime/wsgi.py", line 187, in handle handler = _config_handle.add_wsgi_middleware(self._loadhandler()) file "/users/jdoe/applications/googleappenginelauncher.app/contents/resources/googleappengine-default.bundle/contents/resources/google_appengine/google/appengine/runtime/wsgi.py", line 236, in _loadhandler __import__(cumulative_path) importerror: no module named app 

if rename main.py else main.py , update app.yaml accordingly, error disappears , can run app.

why can no longer have main routines in file called main.py? on app engine sdk download page they're including experimental version of python 2.7 in sdk, have issue i'm experiencing?

thanks help.

my comment answer:

solved myself. in same dir main.py resides had created package called main. in app.yaml, i'd specified in main.app. seems if package called main exists in same dir main.py, python goes inside package module called app. if no package named main exists, happily looks in main.py.


Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -