Don't assume SFTP IO errors have a message attribute.
@@ -19,7 +19,6 @@ from paramiko import (
AuthenticationException,
MissingHostKeyPolicy,
PasswordRequiredException,
- ProxyCommand,
RSAKey,
SFTPClient,
SSHException,
@@ -325,7 +324,8 @@ def _put_file(host, filename_or_io, remote_location):
except IOError as e:
# IO mismatch errors might indicate full disks
- if e.message.startswith('size mismatch in put! 0 !='):
+ message = getattr(e, 'message', None)
+ if message and message.startswith('size mismatch in put! 0 !='):
raise IOError('{0} (disk may be full)'.format(e.message))
raise
