Perfetto.
Ora se lo script e' in funzione e cerco di terminarlo con un "Ctrl+c" ottengo
una serie di warning e KeyboardInterrupt... Come posso gestire questa cosa
in maniera pulita?
Grazie mille ancora
Il 27/07/06, Stefano <[EMAIL PROTECTED]> ha scritto:
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
_______________________________________________ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python