]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
backport loewis' checkin of
authorMichael W. Hudson <mwh@python.net>
Mon, 11 Mar 2002 10:20:36 +0000 (10:20 +0000)
committerMichael W. Hudson <mwh@python.net>
Mon, 11 Mar 2002 10:20:36 +0000 (10:20 +0000)
    revision 1.66 of ftplib.py

Access the exception argument to see whether it starts with '500'.
Fixes #527855.

Lib/ftplib.py

index 2eb3cb295604cdbc30727d3a933dc94ad43ef2ad..01895fd66862f089a15621577fae662d87d7e2eb 100644 (file)
@@ -492,8 +492,8 @@ class FTP:
             try:
                 return self.voidcmd('CDUP')
             except error_perm, msg:
-                if msg[:3] != '500':
-                    raise error_perm, msg
+                if msg.args[0][:3] != '500':
+                    raise
         elif dirname == '':
             dirname = '.'  # does nothing, but could return error
         cmd = 'CWD ' + dirname