wie kann ich herausfinden, welche exceptions von einer Methode erzeugt werden koennen, z.B. dircache.listdir()
http://www.python.org/doc/1.5.2p2/lib/m ... cache.html
Mit einem einfachen "except:" kann ich natuerlich alle abfangen, aber im Python tutorial steht, dass man's so besser nicht macht:
Konkret sieht's so aus:The last except clause may omit the exception name(s), to serve as a wildcard. Use this with extreme caution, since it is easy to mask a real programming error in this way! It can also be used to print an error message and then re-raise the exception (allowing a caller to handle the exception as well).
Code: Alles auswählen
try:
directory_listing = dircache.listdir(directory)
except:
print 'Could not open directory', directory
return
Benoetige Erleuchtung.
Behe0815