Submitted by: Marco Cassiano
N.B Errore già presente anche sulla 2.2.2
select.select (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'])
c.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT)
cursore = c.cursor()
cur0 = c.cursor()
cur0.execute('LISTEN "scheduler"')
cur0.execute('LISTEN "schedulerKill"')
print('In attesa di notify "scheduler" e "schedulerKill";')
TIMEOUT = 8
i=1
while(i):
i +=1
l’errore avviene sulla prossima riga
if select.select([cur0],[],[], TIMEOUT)==([],[],[]):
#self.logger.debug("Timeout(''keepalive'')!")
pass
else:
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 'self.run()'
else: print ("Orrore: notify inaspettato !!!!")
if i == 2: i=0
if name == 'main':
d = mdnlib.dns_postgres_nativo.copy()
test_notify()
______________________________________________
errore:___________________ Notify
In attesa di notify "scheduler" e "schedulerKill";
Traceback (most recent call last):
File "\intranetsvil\discoe tmp\bugPsycopg.py", line 39, in
test_notify()
File "\intranetsvil\discoe tmp\bugPsycopg.py", line 22, in
test_notify
if select.select([cur0],[],[], TIMEOUT)==([],[],[]):
TypeError: argument must be an int, or have a fileno()
method.
Process completed, Exit Code 1.
Execution time: 00:03.151