On 06/24/2013 05:43 PM, chrem wrote:
Le 24/06/13 23:35, chrem a écrit :
Hi,
what is the best way to find out all exceptions for a class?
E.g. I want to find out all exceptions related to the zipfile (I'm
searching for the Bad password exception syntax).
thanks for your help or feedback,
Christophe
without exception, it shown:
RuntimeError: ('Bad password for file', <zipfile.ZipInfo object at
0x100756690>)
then I tried:
except zipfile.BadPassword:
You cannot just make up a name, and hope that it's a valid exception
type. There is no such exception as zipfile.BadPassword. There is an
exception, zipfile.BadZipFile,
as mentioned at
http://docs.python.org/3.3/library/zipfile.html#zipfile.BadZipFile
But of course that's not what you want. The exception type above is
RuntimeError, the part before the colon.
print("Password does not match")
but it returned:
AttributeError: 'module' object has no attribute 'BadPassword'
--
DaveA
--
http://mail.python.org/mailman/listinfo/python-list