Traceback (most recent call last): file "greeting-server.py",line 10,in <module> ns = Pyro4.locateNS() # find the name server file "/usr/lib/python2.7/dist-packages/Pyro4/naming.py",line 344,in locateNS raise ePyro4.errors.NamingError: Failed to locate the nameserver
代码服务器:
# saved as greeting-server.pyimport Pyro4class GreetingMaker(object): def get_fortune(self,name): return "Hello,{0}. Here is your fortune message:\n" \ "Tomorrow's lucky number is 12345678.".format(name)daemon = Pyro4.Daemon() # make a Pyro daemonns = Pyro4.locateNS() # find the name serveruri = daemon.register(GreetingMaker) # register the greeting maker as a Pyro objectns.register("example.greeting",uri) # register the object with a name in the name serverprint("Ready.")daemon.requestLoop() # start the event loop of the server to wait for calls
首先在另一个终端运行pyro-ns:
$pyro-ns*** Pyro name Server ***name server Listening on: ('0.0.0.0',9090)WARNING: daemon bound on hostname that resolves to loopback address 127.0.x.x URI is: PYRO://127.0.1.1:9090/7f0001011d2a21ca9fb63702dd216e1143URI written to: /home/guille/documents/pyro examples/Pyro4-master/examples/banks/Pyro_NS_URIname Server started.
备注:我在Debian 8上工作,我安装了:
> sudo apt-get install pyro4
> sudo apt-get install python2-pyro4
>点子安装https://pypi.python.org/packages/2.7/s/serpent/serpent-
1.7 py2.py3-NONE-any.whl
运行这个例子
也许我错过了什么.任何想法为什么这不起作用,或者我做错了什么?
提前致谢.
首先在另一个终端运行python -m Pyro4.naming:
Not starting broadcast server for localhost.NS running on localhost:9090 (127.0.0.1)URI = PYRO:Pyro.nameServer@localhost:9090
而不是pyro-ns我之前为pyro4做过,因为你看到这个程序改变了
总结以上是内存溢出为你收集整理的python – Pyro4:找不到名称服务器全部内容,希望文章能够帮你解决python – Pyro4:找不到名称服务器所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)