我正在为 GAE 开发应用程序并尝试使用任务队列。目前,我只是通过 GAE 应用程序启动器在我的 Windows 机器上运行该东西,但是每当我尝试将任何东西排入队列时,开发“服务器”崩溃并且日志中充满了讨厌的输出。
taskqueue.add(url='/processWork', params={'key', myModel.key()})
我已经尝试在与其他工作的事务中运行它,所以我很确定工作已成功入队。
然而,不久之后开发服务器崩溃并且日志充满了这样的东西:
ERROR 2011-02-06 17:04:23,289
__init__.py:395] global name 'true' is not defined Traceback (most recent call last): File "C:\Program Files (x86)\Google\google_appengine\google\appengine\ext\webapp\__init__.py", line 517, in __call__
handler.post(*groups) File "C:\Projects\GAE\MyApp\main.py", line 114, in post
activity.approved = true NameError: global name 'true' is not defined INFO 2011-02-06 17:04:23,309 dev_appserver.py:3317] "POST /processWork HTTP/1.1" 500 - WARNING 2011-02-06 17:04:23,309 taskqueue_stub.py:586] Task named "task1" on queue "default" failed with code 500; will retry in 30 seconds Traceback (most recent call last): File "C:\Python27\lib\SocketServer.py", line 284, in _handle_request_noblock
self.process_request(request, client_address) File "C:\Python27\lib\SocketServer.py", line 311, in process_request
self.shutdown_request(request) File "C:\Python27\lib\SocketServer.py", line 459, in shutdown_request
request.shutdown(socket.SHUT_WR) AttributeError: 'FakeConnection' object has no attribute 'shutdown' ERROR 2011-02-06 17:04:23,312 dev_appserver_main.py:494] Error encountered: Traceback (most recent call last):
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_main.py", line 488, in main
http_server.serve_forever()
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 3947, in serve_forever
self.handle_request()
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 3913, in handle_request
self._handle_request_noblock()
File "C:\Python27\lib\SocketServer.py", line 287, in _handle_request_noblock
self.shutdown_request(request)
File "C:\Python27\lib\SocketServer.py", line 459, in shutdown_request
request.shutdown(socket.SHUT_WR) AttributeError: 'FakeConnection' object has no attribute 'shutdown' Now terminating.
---------------------------------------- Exception happened during processing of request from ('0.1.0.2', 80)
---------------------------------------- 2011-02-06 09:04:23 (Process exited with code 1)
道歉 - 下面的回复发现了错字(真的,不是真的)。然而,当试图解决最初的问题时,这悄悄地出现了。如果我修正错字,排队的工作完成,但我的服务器仍然在日志中出现此错误:
INFO 2011-02-06 17:50:32,882 dev_appserver.py:3317] "POST /processWork HTTP/1.1" 200 -
Traceback (most recent call last):
File "C:\Python27\lib\SocketServer.py", line 284, in _handle_request_noblock
self.process_request(request, client_address)
File "C:\Python27\lib\SocketServer.py", line 311, in process_request
self.shutdown_request(request)
File "C:\Python27\lib\SocketServer.py", line 459, in shutdown_request
request.shutdown(socket.SHUT_WR)
AttributeError: 'FakeConnection' object has no attribute 'shutdown'
ERROR 2011-02-06 17:50:32,884 dev_appserver_main.py:494] Error encountered:
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_main.py", line 488, in main
http_server.serve_forever()
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 3947, in serve_forever
self.handle_request()
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 3913, in handle_request
self._handle_request_noblock()
File "C:\Python27\lib\SocketServer.py", line 287, in _handle_request_noblock
self.shutdown_request(request)
File "C:\Python27\lib\SocketServer.py", line 459, in shutdown_request
request.shutdown(socket.SHUT_WR)
AttributeError: 'FakeConnection' object has no attribute 'shutdown'
Now terminating.
----------------------------------------
Exception happened during processing of request from ('0.1.0.2', 80)
----------------------------------------
2011-02-06 09:50:32 (Process exited with code 1)
如果我删除对 taskqueue.add 的调用,它可以正常工作(当然,没有排队的工作)。出了什么问题?