obtaining error number of an error

Viewed 15743

I need to obtain the error number from an error that has occurred in Python.

Ex; When trying to transfer a directory via the Paramiko package, an error is caught with this piece of code:

try:
    sftp.put(local_path,target_path)    
except (IOError,OSError),errno:
    print "Error:",errno

For which I get the output,

Error: [Errno 21] Is a directory

I want to utilize the error number to go into some more code to transfer the directory and the directory contents.

3 Answers
Related