开发者

Python Exception handling in Google App Engine

I have exception handling in my app engine app. The code work perfectly fine on the dev server. But when I upload the file on the app engine server, I get a syntax error.

Here is the traceback:

Exception in request:
Traceback (most recent call last):
  File "/base/python_runtime/python_lib/versions/third_party/django-0.96/django/core/handlers/base.py", line 68, in get_response
    callback, callback_args, callback_kwargs = resolver.resolve(request.path)
  File "/base/py开发者_如何学运维thon_runtime/python_lib/versions/third_party/django-0.96/django/core/urlresolvers.py", line 162, in resolve
    sub_match = pattern.resolve(new_path)
  File "/base/python_runtime/python_lib/versions/third_party/django-0.96/django/core/urlresolvers.py", line 118, in resolve
    return self.callback, args, kwargs
  File "/base/python_runtime/python_lib/versions/third_party/django-0.96/django/core/urlresolvers.py", line 125, in _get_callback
    self._callback = getattr(__import__(mod_name, {}, {}, ['']), func_name)
  File "/base/data/home/apps/foundationofwikipedia/1-1.345018280774164953/src/views.py", line 6, in <module>
    import search_list
  File "/base/data/home/apps/foundationofwikipedia/1-1.345018280774164953/src/search_list.py", line 32
     except Exception as error:
                       ^
 SyntaxError: invalid syntax

I do not understand this as the code works fine in the dev server. It is probably something trivial. HELP!


You're running python 2.6+ on your dev server. App Engine runs on python 2.5.2, which doesn't have the except Exception as foo: syntax. Replace as with a ,, and while you're at it, install Python 2.5 on your dev machine.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜