私は IBM のチュートリアルワークスの例を動かそうとしていますが、今まで運がありませんでした
サーバ:
import calendar, SimpleXMLRPCServer
#The server object
class Calendar:
def getMonth(self, year, month):
return calendar.month(year, month)
def getYear(self, year):
return calendar.calendar(year)
calendar_object = Calendar()
server = SimpleXMLRPCServer.SimpleXMLRPCServer(("localhost", 8888))
server.register_instance(calendar_object)
#Go into the main listener loop
print "Listening on port 8888"
server.serve_forever()
クライアント:
import xmlrpclib
server = xmlrpclib.ServerProxy("http://localhost:8888")
month = server.getMonth(2002, 8)
print month
カレンダーを印刷する必要がありますが、クライアントを実行すると停止し、「ポート 8000 でリッスンしています」のみが印刷されます。
私は python 2.7.2 を使用していますが、チュートリアルは 2002 年 9 月に書かれました。ある種の構文の違いがありますか、それとも何か間違っていますか。
チュートリアル自体はhttp://www.ibm.com/developerworks/webservices/library/ws-pyth10/index.htmlにあります。
前もって感謝します!