sergio brio ha scritto:
Buon giorno a tutti,
Ciao
Se però il server non è raggiungibile ottengo in output un messaggio del
genere:
_mssql.error: DB-Lib error message 20009, severity 9:
Server is unavailable or does not exist.
Come potrei gestire questo errore in maniera "elegante"?
Non conosco il modulo in questione ma ti potrei consigliare
import _mssql
try:
mssql=_mssql.connect('127.0.0.1 <http://127.0.0.1>','sa','')
except:
mssql=None
if (mssql):
print "ok"
mssql.close()
else:
print "ko"
Non ho testato, spero che funzioni ;-)
Saluti
Stefano
_______________________________________________
Python mailing list
Python@lists.python.it
http://lists.python.it/mailman/listinfo/python