gae/python でパイプの破損エラーが発生しましたが、見つけた解決策はどれも私のケースには当てはまらないようです。(たとえば、以下の質問は似ていますが、送信とボタンの使用にかかっていますが、これは私の問題ではありません)。
Google App Engine と jQuery Ajax が Broken Pipe エラーを引き起こす
これが私のJavaScriptです:
var testVar = [1,2]
function testFun() {
jQuery.post("http://localhost:8084",testVar.toString(), function()
{
console.log( "post ok" );
}
)
document.write(testVar)
}
HTMLは次のとおりです。
<!doctype html>
<html>
<head>
<title>Experiment</title>
<meta charset="utf-8" />
<style type="text/css"> </style>
<script type="text/javascript" src="lib/jquery/jquery-1.4.2.js"></script>
<script src="js/posttestjs.js"></script>
</head>
<body>
<input id = "start_button" type="button" onclick= "testFun()" value="begin">
</body>
</html>
そして、ここに私のpythonがあります:
from google.appengine.ext import db
import webapp2
import logging
class data(webapp2.RequestHandler):
def post(self):
logging.info('CHECK1')
self.response.out.write("""<html><body> CHECK2 </body></html>""")
app = webapp2.WSGIApplication([('/', data)] , debug = True)
私が得るエラーはこれです:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 284, in _handle_request_noblock
self.process_request(request, client_address)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 310, in process_request
self.finish_request(request, client_address)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 323, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine- default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py", line 2630, in __init__
BaseHTTPServer.BaseHTTPRequestHandler.__init__(self, *args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 640, in __init__
self.finish()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 693, in finish
self.wfile.flush()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 303, in flush
self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 32] Broken pipe
最後に、これが私の .yaml ファイルです。
application: posttestjs
version: 1
runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /static
static_dir: static
- url: /.*
script: posttestjs.app
ログに CHECK1 が表示されているので、投稿は正常に受信されていると思いますが、応答がありません。
関連する場合:私はfirefoxとpython 2.7.3を使用しています。ありがとう!