This project is archived and is in readonly mode.

#8 ✓invalid
Psycopg website

Errore in

Reported by Psycopg website | November 8th, 2010 @ 05:14 PM

Submitted by: Marco Cassiano

N.B Errore già presente anche sulla 2.2.2 (indipendentemente dalla versione di Postgres, 8.4 o 9.0.1) fallisce sulla referenziazione del cursore, peraltro aperto con successo.
Con la versione 2.2.1 funziona correttamente.

Codice e segnalazione :

import mdnlib
import psycopg2,psycopg2.extensions
import select # per la gestione del notify

def test_notify():

print 'Notify'
c = psycopg2.connect(host = d['host'], database=d['dbname'], user=d['user'], password=psw,port=d['port'])
cursore = c.cursor()

cur0 = c.cursor()
cur0.execute('LISTEN "scheduler"')
cur0.execute('LISTEN "schedulerKill"')
print('In attesa di notify "scheduler" e "schedulerKill";')
    i +=1

l’errore avviene sulla prossima riga

    if[cur0],[],[], TIMEOUT)==([],[],[]):
        if cur0.isready():
            lnotify = cur0.connection.notifies.pop()
            print ("Got NOTIFY: %s " % str(lnotify))
            if lnotify[1] == "schedulerKill": print 'self.kill()'
            elif lnotify[1] == "scheduler":   print ''
            else: print ("Orrore: notify inaspettato !!!!")
    if i == 2: i=0

if name == 'main':

d = mdnlib.dns_postgres_nativo.copy()


______________________________________________ errore:___________________ Notify
In attesa di notify "scheduler" e "schedulerKill";
Traceback (most recent call last):
File "\intranetsvil\discoe tmp\", line 39, in


File "\intranetsvil\discoe tmp\", line 22, in test_notify

if[cur0],[],[], TIMEOUT)==([],[],[]):

TypeError: argument must be an int, or have a fileno() method.

Process completed, Exit Code 1.
Execution time: 00:03.151

Comments and changes to this ticket

  • Daniele Varrazzo

    Daniele Varrazzo November 8th, 2010 @ 05:32 PM

    • State changed from “new” to “invalid”

    Hi Marco,

    there was a change in the async interface in psycopg2 2.2: the object you should put in the select is the connection, not the cursor.

    We know this broke backward compatibility, but async stuff was experimental (and broken) in 2.0. I don't think your code was working with 2.2.1, as cur.fileno() was dropped in 2.2.0: you may have had some previous version installed.

    Easy fix is:

    if[cur0.connection],[],[], TIMEOUT)==([],[],[]):

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

<b>WARNING:</b> the informations in this tracker are archived. Please submit new tickets or comments to <a href="">the new tracker</a>.
Psycopg is the most used PostgreSQL adapter for the Python programming language. At the core it fully implements the Python DB API 2.0 specifications. Several extensions allow access to many of the features offered by PostgreSQL.

Shared Ticket Bins

People watching this ticket

Referenced by