In python 2.71 on Windows XP I need to use FTP.
My code is :
try:
ftp = FTP(trec.address)
ftp.login(trec.login, trec.passw)
s = ftp.retrlines('LIST ' + trec.filetype)
ftp.quit()
except:
(type, value, tb) = sys.exc_info()
reponse = "%s" % value
But I have an error on the last line :
UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xea in position 38: ordinal not in range(128)
As I am in French Windows env. the sys.exc_info()[1] is : [Errno 10061] Aucune connexion n’a pu être établie car l’ordinateur cible l’a expressément refusée
What is the most efficient way to format sys.exc_info()[1] ?
OK, the best way I found is to use traceback like this :