Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

txpostgres: _connect() got an unexpected keyword argument 'async' #103

Open
donalm opened this issue Sep 22, 2018 · 0 comments
Open

txpostgres: _connect() got an unexpected keyword argument 'async' #103

donalm opened this issue Sep 22, 2018 · 0 comments

Comments

@donalm
Copy link

donalm commented Sep 22, 2018

The following example from the txpostgres documentation no longer works with psycopg2cffi:

#!/usr/bin/env pypy                                                             
                                                                                
from txpostgres import txpostgres                                               
                                                                                
from twisted.internet import reactor                                            
from twisted.python import log, util                                            
                                                                                
credentials = {                                                                 
    "dbname": "DBNAME",                                                         
    "user": "USER",                                                             
    "password": "PASSWORD",                                                     
    "port": 5432,                                                               
    "host": "localhost"                                                         
}                                                                               
                                                                                
conn = txpostgres.Connection()                                                  
d = conn.connect(**credentials)                                                 
# run the query and print the result                                            
d.addCallback(lambda _: conn.runQuery('select tablename from pg_tables'))       
d.addCallback(lambda result: util.println('All tables:', result))               
                                                                                
# close the connection, log any errors and stop the reactor                     
d.addCallback(lambda _: conn.close())                                           
d.addErrback(log.err)                                                           
d.addBoth(lambda _: reactor.stop())                                             
                                                                                
# start the reactor to kick off connection estabilishing                        
reactor.run()

The result is:

Unhandled Error
Traceback (most recent call last):
  File "./testscript.py", line 17, in <module>
    d = conn.connect(**credentials)
--- <exception caught here> ---
  File "/Users/donal/Geek/txpostgres/venv/site-packages/txpostgres/txpostgres.py", line 444, in connect
    self._connection = self.connectionFactory(*args, **kwargs)
  File "/Users/donal/Geek/txpostgres/venv/site-packages/psycopg2cffi/__init__.py", line 111, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
exceptions.TypeError: _connect() got an unexpected keyword argument 'async'

It looks like some similar issues were resolved in commit e9434546ad728b5cbc327d4d620d527fd3ffe362 but this one may have been missed.

donalm added a commit to donalm/psycopg2cffi that referenced this issue Sep 22, 2018
lopuhin added a commit that referenced this issue Oct 23, 2019
Replaced argument 'async' with 'async_' #103
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant