0
我有这个项目运行在Google App Engine上,但是当我在本地运行代码以在部署它之前测试错误时,日志不会给出任何错误,代码工作正常。GAE给出了一个错误,没有收到本地测试
当我部署它,GAE给我一个NoneType错误。我有一个修复这个错误,但我不明白的是为什么我会在部署后得到错误,而不是本地?
logal日志:
2016-03-21 21:00:34,466 urlfetch_stub.py:540] Stripped prohibited headers from URLFetch request: ['Host', 'Content-Length']
INFO 2016-03-21 21:00:34,671 module.py:787] default: "GET /testmsg HTTP/1.1" 200 -
成功,没有任何错误。
GAE日志:
Traceback (most recent call last):
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1535, in __call__
rv = self.handle_exception(request, response, e)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1529, in __call__
rv = self.router.dispatch(request, response)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1278, in default_dispatcher
return route.handler_adapter(request, response)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1102, in __call__
return handler.dispatch()
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 572, in dispatch
return self.handle_exception(e, self.app.debug)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 570, in dispatch
return method(*args, **kwargs)
File "/base/data/home/apps/e~thalia-bot/1.391538208721323325/main.py", line 84, in post
textlower = text.lower()
AttributeError: 'NoneType' object has no attribute 'lower'
代码:
text = message.get('text') #Text that the bot will receive
textlower = text.lower() #Convert the text to lowercase
编辑:
几个重新部署后(使用不同的代码),它在不改变原来的代码工作正常。在GAE上给我错误的代码现在正常工作。但是它的不确定性,因为未来的部署将再次引发同样的问题。现在我更加困惑,有没有人发现这里出了什么问题?
我明白你的意思了,这很有道理,生病了吧,谢谢! – Kevin