psycopg2==2.4.4 has a problem with txpostgres
Closed this issue · 2 comments
jrossi commented
I have a quick hack to show the problem. I have not spent much time looking into it, but I have simple test to show the issue:
Example Script:
(txbaaa)[test]% cat pgsql2.py
from txpostgres import txpostgres
import sys
from twisted.internet import defer, reactor
from twisted.python import log
log.startLogging(sys.stdout)
@defer.inlineCallbacks
def example():
conn = txpostgres.Connection()
yield conn.connect(host='localhost', user='txbaaa', database='txbaaa')
r = yield conn.runQuery("Select * from bsession")
print r
defer.returnValue(r)
if __name__ == "__main__":
reactor.callWhenRunning(example)
reactor.run()
Error with version 2.4.4:
(txbaaa)[test]% pip freeze
CorePost==0.0.8
FormEncode==1.2.4
Jinja2==2.6
PyYAML==3.10
Twisted==11.1.0
cyclone==0.4
ldaptor==0.0.0
psycopg2==2.4.4
pyOpenSSL==0.13
pyparsing==1.5.6
pyrad==2.0
six==1.1.0
txpostgres==0.7.0
txredis==2.2
txrestapi==0.1
wsgiref==0.1.2
zope.interface==3.8.0
(txbaaa)[test]% python pgsql2.py
2011-12-28 11:51:01-0500 [-] Log opened.
2011-12-28 11:51:01-0500 [-] Unhandled error in Deferred:
2011-12-28 11:51:01-0500 [-] Unhandled Error
Traceback (most recent call last):
File "/Users/jeremyrossi/src/bb/txbaaa/lib/python2.7/site-packages/twisted/internet/base.py", line 426, in _continueFiring
callable(*args, **kwargs)
File "/Users/jeremyrossi/src/bb/txbaaa/lib/python2.7/site-packages/twisted/internet/defer.py", line 1181, in unwindGenerator
return _inlineCallbacks(None, gen, Deferred())
File "/Users/jeremyrossi/src/bb/txbaaa/lib/python2.7/site-packages/twisted/internet/defer.py", line 1039, in _inlineCallbacks
result = g.send(result)
File "pgsql2.py", line 14, in example
yield conn.connect(host='localhost', user='txbaaa', database='txbaaa')
--- <exception caught here> ---
File "/Users/jeremyrossi/src/bb/txbaaa/lib/python2.7/site-packages/txpostgres/txpostgres.py", line 293, in connect
self._connection = self.connectionFactory(*args, **kwargs)
File "/Users/jeremyrossi/src/bb/txbaaa/lib/python2.7/site-packages/psycopg2/__init__.py", line 179, in connect
connection_factory=connection_factory, async=async)
exceptions.TypeError: argument 1 must be string, not Connection
^C2011-12-28 11:51:03-0500 [-] Received SIGINT, shutting down.
2011-12-28 11:51:03-0500 [-] Main loop terminated.
Working with 2.2:
(txbaaa)[test]% pip freeze
CorePost==0.0.8
FormEncode==1.2.4
Jinja2==2.6
PyYAML==3.10
Twisted==11.1.0
cyclone==0.4
ldaptor==0.0.0
psycopg2==2.2.0
pyOpenSSL==0.13
pyparsing==1.5.6
pyrad==2.0
six==1.1.0
txpostgres==0.7.0
txredis==2.2
txrestapi==0.1
wsgiref==0.1.2
zope.interface==3.8.0
(txbaaa)[test]% python pgsql2.py
2011-12-28 11:54:05-0500 [-] Log opened.
2011-12-28 11:54:05-0500 [cursor] [('jrossi26', 'gateway', '10.1.1.1/32', datetime.datetime(2011, 12, 28, 10, 15, 50, 741080))]
wulczer commented
jrossi commented
Thank you