Best way to trap errors in ftplib?
Mark McEahern
marklists at mceahern.com
Tue Jan 11 19:55:12 EST 2005
Peter A.Schott wrote:
>Using ftplib.FTP object for a project we have here to upload/download files. I
>know that I can wrap everything in try/except blocks, but I'm having trouble
>getting the exact error messages out of the Exceptions.
>
>
Consider using the traceback a la:
try:
[... whatever ...]
except:
import sys, traceback
t, v, tb = sys.exc_info()
# or use StringIO to "print" the traceback to and then log *that*
traceback.print_tb(tb)
// m
More information about the Python-list
mailing list