wrap_socket() 得到了一个意外的关键字参数 '_context' 和 deserialize(error) [英] wrap_socket() got an unexpected keyword argument '_context' and deserialize(error)

查看:61
本文介绍了wrap_socket() 得到了一个意外的关键字参数 '_context' 和 deserialize(error)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用请求来获取文件的 url.它在本地运行良好,但不适用于 nameko.

I try to use requests to get a url of file. It works well locally but it doesn't work with nameko.

我尝试了 3 个 python3.7 库.但都有同样的错误.导入 urllib.request,urllib3,requests

I tried 3 libs of python3.7. But all has the same error. import urllib.request,urllib3,requests

它在本地运行良好,如下所示:

it works well locally like this:

import requests
url = "https://www.python.org/static/img/python-logo.png"
r = requests.get(url)
print(r.content)

但它不能与 nameko 一起使用:

But it can't work with nameko:

import requests
from nameko.web.handlers import http

@http("POST", "/import")
def testurl(self,request):
    url = "https://www.python.org/static/img/python-logo.png"
    r = requests.get(url)
    print(r.content)

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/usr/local/lib/python3.7/site-packages/nameko/rpc.py", line 373, in __call__
    return reply.result()
  File "/usr/local/lib/python3.7/site-packages/nameko/rpc.py", line 331, in result
    raise deserialize(error)
nameko.exceptions.RemoteError: Exception Error on testurl: Cause : wrap_socket() got an unexpected keyword argument '_context'

推荐答案

这是一个 eventlet 错误.如果可能,您需要降级到 Python 3.6.

It is an eventlet bug. If it is possible you need to downgrade to Python 3.6.

https://github.com/eventlet/eventlet/issues/526

Nameko 对此问题有一个 PR,在解决上述问题之前暂停.

Nameko has a PR for this issue which is on pause until the above is fixed.

https://github.com/nameko/nameko/pull/644

这篇关于wrap_socket() 得到了一个意外的关键字参数 '_context' 和 deserialize(error)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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