Python - problemas con servidor

 
Vista:

problemas con servidor

Publicado por Edgar (1 intervención) el 22/09/2005 13:38:39
Hola tengo el siguiente problema tengo un servidor que ofrece un servicio este servidor lo corro en phyton y es el siguiente codigo:

import sys
import ConceptNetDB
import DocXMLRPCServer
pred_filename = "ConceptNet.ini"
if len(sys.argv)>0 and sys.argv[-1][-1*len('.py'):].lower()!='.py':
pred_filename = sys.argv[-1]
print "Syntax: python ConceptNetXMLRPCServer.py [predicates_file]"
print "Loading Predicates from %s..."%pred_filename
c =ConceptNetDB.ConceptNetDB(None,pred_filename)
print "Starting XML-RPC Server"
port = 8000
xmlrpc = DocXMLRPCServer.DocXMLRPCServer(('',port))
print "Now serving on localhost port %s!"%str(port)
xmlrpc.register_introspection_functions()
xmlrpc.register_instance(c)
xmlrpc.register_instance(c.nltools)
xmlrpc.serve_forever()

al ejecutar este codigo el servidor queda activo en la siguiente difreecion:

Starting XML-RPC Server
Now serving on localhost port 8000!

hasta ahi todo esta bien, pero cuando ejecuto otro programa que me permita accesar al servidor usando xml-rpc en phyton me da error, el servidro que muestro anteriormente tiene una clase llama ConceotNetDB y los soguientes metodos:

class ConceptNetDB
Methods defined here:
getuid(self)
load_predicates(self)
nodeuid2zipped(self, uid)
optimize_order(self)
pp_predicate(self, pred)

este es mi codigo para accesar al server:

from xmlrpclib import Server
betty = Server("http://localhost:8000")
print betty.conceptnetdb.getuid()

pero me da error, ya probe el codigo con otros servidore xml-rpc y si me deja accesar pero con este no, que es lo que estoy haciendo mal, espero que alguien pueda ayudarme, a continuacion pongo el error que me da:

raceback (most recent call last):
File "C:\Documents and Settings\Edgar.DEVELOPERS\Mis documentos\ejemplo.py", line 4, in -toplevel-
print betty.conceptnetdb.getuid()
File "C:\Python24\lib\xmlrpclib.py", line 1096, in __call__
return self.__send(self.__name, args)
File "C:\Python24\lib\xmlrpclib.py", line 1383, in __request
verbose=self.__verbose
File "C:\Python24\lib\xmlrpclib.py", line 1129, in request
self.send_content(h, request_body)
File "C:\Python24\lib\xmlrpclib.py", line 1243, in send_content
connection.endheaders()
File "C:\Python24\lib\httplib.py", line 794, in endheaders
self._send_output()
File "C:\Python24\lib\httplib.py", line 675, in _send_output
self.send(msg)
File "C:\Python24\lib\httplib.py", line 642, in send
self.connect()
File "C:\Python24\lib\httplib.py", line 626, in connect
raise socket.error, msg
error: (10061, 'Connection refused')


alguien puede ayudarme, gracias
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder