使用 Django Piston 出现管道损坏错误
我已经实现了一个简单的 POST 处理程序,用于使用 Django Piston 上传文件。我正在使用manage.py runserver 进行测试。当我的处理程序抛出异常时,我在控制台中收到错误:“[Errno 32] 管道损坏”。回溯位于 Python 套接字服务器代码的某个地方。显然,异常导致管道损坏,这就是控制台中显示的错误。
有没有一种简单的方法可以记录我的处理程序中的实际异常和回溯?否则找出问题确实很困难。
I've implemented a simple POST handler for uploading a file using Django Piston. I'm testing with manage.py runserver. When my handler throws an exception, I get an error in the console: "[Errno 32] Broken pipe". The traceback is somewhere is the Python socket server code. Obviously the exception is causing the pipe to be broken and that is the error that shows up in the console.
Is there an easy way to get the actual exception and traceback in my handler to be logged? Otherwise hunting down the problem is really difficult.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我自己想出了这个办法。这是我的错误,因为我使用“curl -f”来发出请求,所以curl不会读取服务器的响应,而是切断管道并向shell返回错误。
不过也可能发生在其他人身上,所以我重新命名了这个问题,以更清楚地说明发生了什么。
I figured this one out myself. It was my mistake since I was using "curl -f" to make my request, so curl doesn't read the response from the server but cuts the pipe instead and returns an error to the shell.
Could happen to someone else though so I renamed the question to make it clearer what was going on.