1

在尝试有关 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
>>>
4

1 回答 1

2

Kombu 最近承诺要求 amqp>=2.4.0,<3.0。恢复到 amqp v2.3.2 解决了这个问题。我建议使用 Kombu v4.2.1 而不是 v4.2.2.post1。

于 2019-01-17T09:33:17.250 回答