2011-02-06 16 views
4

GAE用のアプリケーションを開発中で、タスクキューを使用しようとしています。現在のところ、GAE App Launcherを使用してWindowsボックスで実行しているだけですが、何かをエンキューしようとすると、開発サーバーがクラッシュし、ログには厄介な出力がいっぱいです。Google App Engineのタスクキュー - 厄介なエラー

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の呼び出しを削除した場合、それは当然のことながら、キューに入れられた作業をせずに(正常に動作します)。何がうまくいかないのですか?

+3

をインポートしないということです。 http://code.google.com/appengine/docs/python/gettingstarted/devenvironment.htmlこれが現在の問題に影響するかどうかはわかりません。 – kevpie

答えて

8
File "C:\Python27\lib\SocketServer.py" 

activity.approved = true 

を変更

App EngineはPython 2.5で動作し、Python 2.7を使用しています。

+0

本当ですか?今私は新しい問題を抱えていますか? Python 2.5 for Windowsはどこで入手できますか?私はPythonサイトで.tarファイルを見つけることができますが、それはちょうど(一見無作為な、私にとっては)たくさんのソースから満ちています。 – ConfusedNoob

+0

http://code.google.com/appengine/docs/python/runtime.html#Pure_Pythonによると、アプリエンジンは2.5.2を使用します。これはhttp://www.pythonから入手できます。org /ダウンロード/リリース/ 2.5.2 / –

5

簡単なタイプミスのように見える:

__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 

ゴーmain.pyライン395へと

activity.approved = True 

(大文字の "T")

+0

ああああ、それは恥ずかしい。しかし、それは私が問題を経験した後に忍び寄った少しのタイプミスです。これを修正すると、キューに入れられたタスクは機能しますが、サーバーはまだクラッシュします。元の質問への更新を参照してください。ここで私の混乱のためにお詫び申し上げます。 – ConfusedNoob

0

ええ、あなたが2.7を使用しているからです。 shutdown()2.6に加えた。 2.5を実行しなければなりません。

0

することはでき(実際はPython 2.7.1、pyOpenSSL 0.12とWERKZEUG 0.6.2のように必要)、このためで修正でモンキーパッチ:

### WARNING: Monkey patch in a fix to correct pyOpenSSL's 
### incompatible ServerSocket implementation that accepts zero arguments 
### for shutdown() instead of one. Fix is for: 
### lib/python2.7/SocketServer.py:459's shutdown() call because that 
### appears to be easier to quickly hack in versus patching 
### pyOpenSSL. Again, don't use this for production, but it's great for 
### testing. 
def monkeyp_ssl_shutdown_request(self, request): 
    try: 
     request.shutdown() 
    except socket.error: 
     pass #some platforms may raise ENOTCONN here 
    self.close_request(request) 
from SocketServer import TCPServer 
TCPServer.shutdown_request = monkeyp_ssl_shutdown_request 

きれいではありませんが、それは例外ときよりはましです誰かがSSL TCP接続を閉じます。

app.run(ssl_context='adhoc') # Now works 
0

もう一つ考えられる理由は、あなたがAppEngineの開発のためのpython 2.5を使用する必要がありますmidule

from google.appengine.api import taskqueue