Commits

Benjamin Peterson committed 27e4709

use correct format code for exceptions

Comments (0)

Files changed (1)

Lib/urllib/request.py

                 conn, retrlen = self.ftp.ntransfercmd(cmd)
             except ftplib.error_perm as reason:
                 if str(reason)[:3] != '550':
-                    raise URLError('ftp error: %d' % reason).with_traceback(
+                    raise URLError('ftp error: %r' % reason).with_traceback(
                         sys.exc_info()[2])
         if not conn:
             # Set transfer mode to ASCII!
                     try:
                         self.ftp.cwd(file)
                     except ftplib.error_perm as reason:
-                        raise URLError('ftp error: %d' % reason) from reason
+                        raise URLError('ftp error: %r' % reason) from reason
                 finally:
                     self.ftp.cwd(pwd)
                 cmd = 'LIST ' + file