I am new to Python and Pyro4. So I try to follow the second example of this Pyro page - Python Remote Objects - 4.41 , but this is the exception when starting the server:
Traceback (most recent call last):
File "greeting-server.py", line 10, in <module>
ns = Pyro4.locateNS()
File "/usr/lib/python2.7/dist-packages/Pyro4/naming.py", line 344, in locateNS
raise e
Pyro4.errors.NamingError: Failed to locate the nameserver
Code Server:
import Pyro4
class GreetingMaker(object):
def get_fortune(self, name):
return "Hello, {0}. Here is your fortune message:\n" \
"Tomorrow lucky number is 12345678.".format(name)
daemon = Pyro4.Daemon()
ns = Pyro4.locateNS()
uri = daemon.register(GreetingMaker)
ns.register("example.greeting", uri)
print("Ready.")
daemon.requestLoop()
First run pyro-ns at the other end:
$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:
URI written to: /home/guille/Documents/pyro examples/Pyro4-master/examples/banks/Pyro_NS_URI
Name Server started.
Note: I am working on Debian 8 and I installed:
to run this example
Maybe I missed something. Any ideas why this doesn't work, or the things I'm doing wrong? thanks in advance.
source
share