self._socket.bind(address)文件“<string>”,第1行,绑定TypeError:需要一个整数</string>

时间:2013-11-17 03:01:18

标签: python python-2.7 multiprocessing

我正在使用Python 2.6并尝试为给定端口和authkey启动管理器

import multiprocessing
from multiprocessing.managers import SyncManager

    def make_server_manager(port, authkey):
            # ...

        class JobQueueManager(SyncManager):
                pass
        # ...

        manager = JobQueueManager(address=("127.0.0.1", port), authkey=authkey)
        manager.start()

        return manager

但我收到错误消息:

[hue@sandbox ~]$ python ####.py 5000 abc
Process JobQueueManager-1:
Traceback (most recent call last):
  File "/usr/lib64/python2.6/multiprocessing/process.py", line 232, in _bootstrap
    self.run()
  File "/usr/lib64/python2.6/multiprocessing/process.py", line 88, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib64/python2.6/multiprocessing/managers.py", line 517, in _run_server
    server = cls._Server(registry, address, authkey, serializer)
  File "/usr/lib64/python2.6/multiprocessing/managers.py", line 136, in __init__
    self.listener = Listener(address=address, backlog=5)
  File "/usr/lib64/python2.6/multiprocessing/connection.py", line 106, in __init__
    self._listener = SocketListener(address, family, backlog)
  File "/usr/lib64/python2.6/multiprocessing/connection.py", line 227, in __init__
    self._socket.bind(address)
  File "<string>", line 1, in bind
TypeError: an integer is required
Traceback (most recent call last):
...
    manager = make_server_manager(PORTNUM, AUTHKEY)
  File "####.py", line 145, in make_server_manager
    manager.start()
  File "/usr/lib64/python2.6/multiprocessing/managers.py", line 499, in start
    self._address = reader.recv()
EOFError

有人可以建议在地址中输入什么内容吗?在尝试绑定到地址时似乎失败了。正如错误所示,地址怎么可以是整数?或者是我在运行时给出的端口5000?

提供具有类似输入的多处理线程以供参考:

How-to-synchronize-a-Python-dict-with-multiprocessing

0 个答案:

没有答案