我遇到了Pyro4的问题,当我尝试连接到我的python服务器时,它从不连接。但据我所知,服务器运行正常。我总是得到 '未连接' 问题。当它没有连接时,我不能对我的对象进行任何python函数调用。
以下是我列出环境中正在运行的内容时的样子
MELO@fence-with-pyro log]pyro4-nsc list
--------START LIST
Pyro.NameServer --> PYRO:Pyro.NameServer@29.21.14.125:9090
CASA --> PYRO:obj_c74c1737b5894d90b10d64326e70355a@29.21.14.125:36582
--------END LIST
MELO@fence-with-pyro log]
据我所知,一切看起来都不错。我这样开始CASA:
这是CASA(名称服务器)控制台输出 - (正在运行)
Pyro4 config Pyro version: 4.38
Loaded from: /usr/lib/python2.6/site-packages/Pyro4-4.38-py2.6.egg/Pyro4
Python version: CPython 2.6.6 (Linux, posix)
Protocol version: 48
Currently active configuration settings:
AUTOPROXY = True
BROADCAST_ADDRS = <broadcast>, 0.0.0.0
COMMTIMEOUT = 0.0
COMPRESSION = False
DETAILED_TRACEBACK = True
FLAME_ENABLED = False
HOST = 29.21.14.125
JSON_MODULE = json
LOGFILE = /castle/pyro_.log
LOGLEVEL = DEBUG
LOGWIRE = True
MAX_MESSAGE_SIZE = 0
METADATA = True
NATHOST = None
NATPORT = 0
NS_BCHOST = None
NS_BCPORT = 9091
NS_HOST = localhost
NS_PORT = 9090
ONEWAY_THREADED = True
PICKLE_PROTOCOL_VERSION = 2
POLLTIMEOUT = 2.0
PREFER_IP_VERSION = 4
REQUIRE_EXPOSE = False
SERIALIZER = json
SERIALIZERS_ACCEPTED = set(['json', 'marshal', 'serpent'])
SERVERTYPE = thread
SOCK_NODELAY = False
SOCK_REUSE = False
THREADING2 = False
THREADPOOL_SIZE = 16
USE_MSG_WAITALL = True
!(casaNameServer) Starting CASA Pyro4 NameServer
Object <__main__.CasaNameServer object at 0x29bfc90>:
uri = PYRO:obj_c74c1737b5894d90b10d64326e70355a@29.21.14.125:36582
name = CASA
Pyro daemon running.
注意:我也试过将NS_HOST设置为ip地址而不是localhost,但它对问题没有影响。
以下是我手动执行步骤时所发生情况的示例
MELO@fence-with-pyro log]python
Python 2.6.6 (r266:84292, Jan 22 2014, 09:42:36)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import Pyro4
>>> x = Pyro4.locateNS(host='29.21.14.125',port=9090)
>>> x
<Pyro4.core.Proxy at 0x25ac510, connected, for PYRO:Pyro.NameServer@29.21.14.125:9090>
>>> uri = x.lookup('CASA')
>>> uri
<Pyro4.core.URI at 0x257d470, PYRO:obj_c74c1737b5894d90b10d64326e70355a@29.21.14.125:36582>
>>> from Pyro4.util import getPyroTraceback
>>> getPyroTraceback()
['None\n']
>>> Pyro4.Proxy(uri)
<Pyro4.core.Proxy at 0x25ac5d0, not connected, for PYRO:obj_c74c1737b5894d90b10d64326e70355a@29.21.14.125:36582>
>>> getPyroTraceback()
['None\n']
是什么导致这种情况发生? 有没有办法追查这种错误?像更深层次的调试来解决问题?
答案 0 :(得分:0)
好吧,我终于把这一切都搞定了。显然“没有联系”是正常的。我发现的是“未连接”状态是可以忽略的。即使是Pyro4示例页面上的仓库示例,如果一个打印仓库页面,仓库也“未连接”。