0
我使用谷歌應用程序引擎Python和遇到類似這樣的錯誤:谷歌的App Engine(Python的SDK) - 如何捕捉分貝例外
raise BadValueError('Property %s is not multi-line' % self.name)
BadValueError: Property title is not multi-line
ERROR 2014-09-20 16:01:23,969 wsgi.py:278]
Traceback (most recent call last):
我已經導入了數據庫模塊:from google.appengine.ext import db
而且我試圖默默(現在)與捉代碼中的錯誤是這樣的:
try:
r.put()
except db.Error:
pass
但錯誤繼續中斷程序執行。我究竟做錯了什麼? (?或不做)
謝謝...
以下是完整的回溯:
Traceback (most recent call last):
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2-2.3/webapp2.py", line 1511, in __call__
rv = self.handle_exception(request, response, e)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2-2.3/webapp2.py", line 1505, in __call__
rv = self.router.dispatch(request, response)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2-2.3/webapp2.py", line 1253, in default_dispatcher
return route.handler_adapter(request, response)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2-2.3/webapp2.py", line 1077, in __call__
return handler.dispatch()
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2-2.3/webapp2.py", line 547, in dispatch
return self.handle_exception(e, self.app.debug)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2-2.3/webapp2.py", line 545, in dispatch
return method(*args, **kwargs)
File "/Users/me/myapp/myapp.py", line 191, in get
date_last_modified = date_last_modified)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/db/__init__.py", line 970, in __init__
prop.__set__(self, value)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/db/__init__.py", line 614, in __set__
value = self.validate(value)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/db/__init__.py", line 2847, in validate
raise BadValueError('Property %s is not multi-line' % self.name)
BadValueError: Property column_series is not multi-line
對於初學者來說,你會發現錯誤的例外。例外是'BadValueError'。 – 2014-09-20 16:20:14
@BurhanKhalid:'db.BadValueError'是'db.Error'的子類。 – 2014-09-20 16:28:24
你有正確的例外;但你是否在正確的位置*捕捉到它?請向我們展示完整的追溯。 – 2014-09-20 16:28:52