versuche gerade eine RemoteDB Schnittstelle mit Pyro zu entwickeln.
Hier Ausschnitte vom Quelltext.
Remote Klasse:
Code: Alles auswählen
class DBConnector(Pyro.core.ObjBase):
def __init__(self):
Pyro.core.ObjBase.__init__(self)
def connect(self):
self.connection = psycopg2.connect(host="localhost", port=5432, user="xxx",
password="xxx", database="xxx")
return self.getProxy()
def cursor(self):
print "cur"
self.cursor = self.connection.cursor()
return self.getProxy()
def execute(self, sql, args=None):
try:
self.cursor.execute(sql, args)
except:
pass
def commit(self):
self.connection.commit()
Client:
Code: Alles auswählen
connector = uri.getProxy()
connection = connector.connect()
cursor = connection.cursor()
cursor.execute("INSERT INTO test VALUES (5, 'testing')")
connection.commit()
cursor = connection.cursor()
cursor.execute("INSERT INTO test VALUES (5, 'testing')")
connection.commit()
Code: Alles auswählen
File "G:\E-Konst\!ServiceTool\dbRemote\client.py", line 17, in <module>
cursor = connection.cursor()
File "G:\E-Konst\!ServiceTool\dbRemote\Pyro\core.py", line 392, in __call__
return self.__send(self.__name, args, kwargs)
File "G:\E-Konst\!ServiceTool\dbRemote\Pyro\core.py", line 462, in _invokePYRO
return self.adapter.remoteInvocation(name, Pyro.constants.RIF_VarargsAndKeywords, vargs, kargs)
File "G:\E-Konst\!ServiceTool\dbRemote\Pyro\protocol.py", line 429, in remoteInvocation
return self._remoteInvocation(method, flags, *args)
File "G:\E-Konst\!ServiceTool\dbRemote\Pyro\protocol.py", line 529, in _remoteInvocation
answer.raiseEx()
File "G:\E-Konst\!ServiceTool\dbRemote\Pyro\errors.py", line 72, in raiseEx
raise self.excObj
TypeError: 'psycopg2._psycopg.cursor' object is not callable
Ich bin ratlos...