错误:[Errno 32] 当 paypal 回调到 python django 应用程序时管道损坏 [英] error: [Errno 32] Broken pipe when paypal calls back to python django app

查看:10
本文介绍了错误:[Errno 32] 当 paypal 回调到 python django 应用程序时管道损坏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在与我的 django 应用程序进行 papal 集成.

Hi I am doing papal integration with my django app.

我正在使用来自 svn 和 python 2.6 的最新版本的 django.

i am using latest version of django from svn and python 2.6.

但是,我发现每次当 paypal 的沙箱访问我的通知 url 时,我都会收到 500 [Errno 32] Broken pipe 我的 django 堆栈.

However, i found every time when paypal's sandbox accessing my notify url i got 500 [Errno 32] Broken pipe my django stack.

有没有人有类似的经历?

Does anyone have similar experience with this ?

干杯,

Traceback (most recent call last):
  File "/usr/lib/python2.6/dist-packages/django/core/servers/basehttp.py", line 281, in run
    self.finish_response()
  File "/usr/lib/python2.6/dist-packages/django/core/servers/basehttp.py", line 321, in finish_response
    self.write(data)
  File "/usr/lib/python2.6/dist-packages/django/core/servers/basehttp.py", line 417, in write
    self._write(data)
  File "/usr/lib/python2.6/socket.py", line 318, in write
    self.flush()
  File "/usr/lib/python2.6/socket.py", line 297, in flush
    self._sock.sendall(buffer(data, write_offset, buffer_size))
error: [Errno 104] Connection reset by peer
----------------------------------------
Exception happened during processing of request from ('216.113.191.33', 21736)
Traceback (most recent call last):
  File "/usr/lib/python2.6/SocketServer.py", line 283, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/usr/lib/python2.6/SocketServer.py", line 309, in process_request
    self.finish_request(request, client_address)
  File "/usr/lib/python2.6/SocketServer.py", line 322, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python2.6/dist-packages/django/core/servers/basehttp.py", line 562, in __init__
    BaseHTTPRequestHandler.__init__(self, *args, **kwargs)
  File "/usr/lib/python2.6/SocketServer.py", line 618, in __init__
    self.finish()
  File "/usr/lib/python2.6/SocketServer.py", line 661, in finish
    self.wfile.flush()
  File "/usr/lib/python2.6/socket.py", line 297, in flush
    self._sock.sendall(buffer(data, write_offset, buffer_size))
error: [Errno 32] Broken pipe
----------------------------------------

推荐答案

有两个问题.首先,一些 paypal API(尤其是 MassPay)非常糟糕.

There are two problems. First, some of the paypal APIs (particularly MassPay) are terribly poor.

第二个更可能的问题是您的服务器是单线程的,并且无法正确地向 paypal 提出异常.我能够通过创建一个带有模拟 paypal IPN 的表单(通过 POST)的 html 文件,然后查看调试结果(或者更好,使用像 PyDev 中的调试器那样的调试器)来解决类似的问题.当然,你可以用 curl 做同样的事情.

The second, and more likely, problem, is that your server is single-threaded and is having trouble properly raising an exception to paypal. I was able to resolve a similar problem by creating an html file with a form (via POST) that mocked a paypal IPN and then looking at the debug result (or better, using a debugger like the one in PyDev). You could do the same thing with curl of course.

这篇关于错误:[Errno 32] 当 paypal 回调到 python django 应用程序时管道损坏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆