2011-05-09 35 views
1

我試圖得到一個簡單的例子火焰兵運行(taken from this page),這是代碼:錯誤使用域名服務器開始火焰兵守護程序:「找不到名稱服務器」

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() 

當我運行此腳本Python的2.6.5和Python 2.6.6(在Ubuntu 10.04和Debian擠壓都嘗試),我總是得到這個錯誤:

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 

有什麼不好的腳本?我如何創建該名稱服務器?

回答

4

在另一個終端首先運行pyro-ns。這就是Pyro物件經紀人。