]> granicus.if.org Git - python/commitdiff
Access the exception argument to see whether it starts with '500'.
authorMartin v. Löwis <martin@v.loewis.de>
Sun, 10 Mar 2002 15:59:58 +0000 (15:59 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Sun, 10 Mar 2002 15:59:58 +0000 (15:59 +0000)
Fixes #527855.

Lib/ftplib.py

index cad7a5b90db45a57b5b9a70ce00f088bd5bea59f..aaf12fef6a2488c09ed70c2571d7342818dec158 100644 (file)
@@ -487,8 +487,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