在尝试有关python框架nameko的非常基本的示例时,出现类似以下错误:BlockingIOError: [WinError 10035] A non-blocking socket operation could not be completed immediately

知道它的来源吗?



我正在使用python 3.7.0,最新版本的nameko和RabbitMQ 3.7.10

这是我要测试的源代码(!)

# helloworld.py

from nameko.rpc import rpc

class GreetingService:
    name = "greeting_service"

    @rpc
    def hello(self, name):
        return "Hello, {}!".format(name)


这是我们得到的错误:

>>> n.rpc.greeting_service.hello(name="test")
===== 2019.01.17 08:01:18 =====
Traceback (most recent call last):
  File "c:\users\xxx\appdata\local\programs\python\python37\lib\site-packages\kombu\connection.py", line 414, in _reraise_as_library_errors
    yield
  File "c:\users\xxx\appdata\local\programs\python\python37\lib\site-packages\kombu\connection.py", line 494, in _ensured
    return fun(*args, **kwargs)
  File "c:\users\xxx\appdata\local\programs\python\python37\lib\site-packages\kombu\messaging.py", line 203, in _publish
    mandatory=mandatory, immediate=immediate,
  File "c:\users\xxx\appdata\local\programs\python\python37\lib\site-packages\amqp\channel.py", line 1782, in basic_publish_confirm
    ret = self._basic_publish(*args, **kwargs)
  File "c:\users\xxx\appdata\local\programs\python\python37\lib\site-packages\amqp\channel.py", line 1758, in _basic_publish
    self.connection.drain_events(timeout=0)
  File "c:\users\xxx\appdata\local\programs\python\python37\lib\site-packages\amqp\connection.py", line 500, in drain_events
    while not self.blocking_read(timeout):
  File "c:\users\xxx\appdata\local\programs\python\python37\lib\site-packages\amqp\connection.py", line 505, in blocking_read
    frame = self.transport.read_frame()
  File "c:\users\xxx\appdata\local\programs\python\python37\lib\site-packages\amqp\transport.py", line 250, in read_frame
    frame_header = read(7, True)
  File "c:\users\xxx\appdata\local\programs\python\python37\lib\site-packages\amqp\transport.py", line 430, in _read
    s = recv(n - len(rbuf))
BlockingIOError: [WinError 10035] A non-blocking socket operation could not be completed immediately

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\xxx\appdata\local\programs\python\python37\lib\code.py", line 90, in runcode
    exec(code, self.locals)
  File "<console>", line 1, in <module>
  File "c:\users\christianmoret\appdata\local\programs\python\python37\lib\site-packages\nameko\rpc.py", line 372, in __call__
    reply = self._call(*args, **kwargs)
  File "c:\users\xxx\appdata\local\programs\python\python37\lib\site-packages\nameko\rpc.py", line 445, in _call
    extra_headers=extra_headers
  File "c:\users\xxx\appdata\local\programs\python\python37\lib\site-packages\nameko\amqp\publish.py", line 210, in publish
    **publish_kwargs
  File "c:\users\xxx\appdata\local\programs\python\python37\lib\site-packages\kombu\messaging.py", line 181, in publish
    exchange_name, declare,
  File "c:\users\christianmoret\appdata\local\programs\python\python37\lib\site-packages\kombu\connection.py", line 527, in _ensured
    errback and errback(exc, 0)
  File "c:\users\xxx\appdata\local\programs\python\python37\lib\contextlib.py", line 130, in __exit__
    self.gen.throw(type, value, traceback)
  File "c:\users\xxx\appdata\local\programs\python\python37\lib\site-packages\kombu\connection.py", line 419, in _reraise_as_library_errors
    sys.exc_info()[2])
  File "c:\users\xxx\appdata\local\programs\python\python37\lib\site-packages\vine\five.py", line 194, in reraise
    raise value.with_traceback(tb)
  File "c:\users\xxx\appdata\local\programs\python\python37\lib\site-packages\kombu\connection.py", line 414, in _reraise_as_library_errors
    yield
  File "c:\users\xxx\appdata\local\programs\python\python37\lib\site-packages\kombu\connection.py", line 494, in _ensured
    return fun(*args, **kwargs)
  File "c:\users\xxx\appdata\local\programs\python\python37\lib\site-packages\kombu\messaging.py", line 203, in _publish
    mandatory=mandatory, immediate=immediate,
  File "c:\users\xxx\appdata\local\programs\python\python37\lib\site-packages\amqp\channel.py", line 1782, in basic_publish_confirm
    ret = self._basic_publish(*args, **kwargs)
  File "c:\users\xxx\appdata\local\programs\python\python37\lib\site-packages\amqp\channel.py", line 1758, in _basic_publish
    self.connection.drain_events(timeout=0)
  File "c:\users\xxx\appdata\local\programs\python\python37\lib\site-packages\amqp\connection.py", line 500, in drain_events
    while not self.blocking_read(timeout):
  File "c:\users\xxx\appdata\local\programs\python\python37\lib\site-packages\amqp\connection.py", line 505, in blocking_read
    frame = self.transport.read_frame()
  File "c:\users\xxx\appdata\local\programs\python\python37\lib\site-packages\amqp\transport.py", line 250, in read_frame
    frame_header = read(7, True)
  File "c:\users\xxx\appdata\local\programs\python\python37\lib\site-packages\amqp\transport.py", line 430, in _read
    s = recv(n - len(rbuf))
kombu.exceptions.OperationalError: [WinError 10035] A non-blocking socket operation could not be completed immediately
>>>

最佳答案

Kombu最近承诺要求amqp> = 2.4.0,

08-19 07:34