Error starting Pyro Daemon using a NameServer: “could not find NameServer”

StackOverflow https://stackoverflow.com/questions/5933016

  •  30-10-2019
  •  | 
  •  

Frage

I'm trying to get a simple Pyro example running (taken from this page), this is the code:

import Pyro.core
import Pyro.naming

class JokeGen(Pyro.core.ObjBase):
  def joke(self, name):
    return "Sorry "+name+", I don't know any jokes."

daemon=Pyro.core.Daemon()
ns=Pyro.naming.NameServerLocator().getNS()
daemon.useNameServer(ns)
uri=daemon.connect(JokeGen(),"jokegen")
daemon.requestLoop()

When I run this script with Python 2.6.5 and Python 2.6.6 (tried both on Ubuntu 10.04 and Debian Squeeze), I'm always getting this error:

Traceback (most recent call last):
  File "/home/ingo/tools/python/pyroserver.py", line 9, in <module>
    ns=Pyro.naming.NameServerLocator().getNS()
  File "/usr/lib/pymodules/python2.6/Pyro/naming.py", line 176, in getNS
    reply = self.sendSysCommand(NS_SYSCMD_LOCATION,host,port,trace,1,bcaddr)
  File "/usr/lib/pymodules/python2.6/Pyro/naming.py", line 76, in sendSysCommand
    raise Pyro.errors.NamingError("could not find NameServer")
Pyro.errors.NamingError: could not find NameServer

What's wrong with the script? How can I create that nameserver?

Keine korrekte Lösung

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top