# Get the default charset.
try:
lcAll = locale.getdefaultlocale()
- except locale.Error, err:
+ except locale.Error as err:
print("WARNING:", err, file=sys.stderr)
lcAll = []
else:
try:
default_encoding = locale.getpreferredencoding()
- except locale.Error, err:
+ except locale.Error as err:
print("WARNING:", err, file=sys.stderr)
default_encoding = sys.getdefaultencoding()
else:
get_files = GetFiles()
try:
ftp.dir(get_files)
- except ftplib.all_errors, msg:
+ except ftplib.all_errors as msg:
tree.append((ftpscan_error_mark, "Cannot list directory `%s': %s" % (ftp_dir, msg)))
return
files = get_files.files()
full_path = ftp_dir + '/' + name
try:
ftp.cwd(name)
- except ftplib.error_perm, msg:
+ except ftplib.error_perm as msg:
tree.append((ftpscan_error_mark, "Cannot enter directory `%s': %s" % (full_path, msg)))
if isinstance(ftp, ReconnectingFTPWrapper):
ftp.cwd("..", False)
- except ftplib.all_errors, msg:
+ except ftplib.all_errors as msg:
tree.append((ftpscan_error_mark, "Cannot enter directory `%s': %s" % (full_path, msg)))
else:
_traverse_ftp(ftp, tree, full_path)
print("Scanning", ftp_server)
try:
test(ftp_server, ftpscanrecursive, passive)
- except FtpScanError, msg:
+ except FtpScanError as msg:
print("Rescanning due to the error:", msg)
try:
test(ftp_server, ftpscan1, passive)