[Tutor] Cannot fix OSError (try/except)

Alan Gauld alan.gauld at blueyonder.co.uk
Sat Jan 31 13:27:48 EST 2004


LLoyd,

> Is there any way a try/except at this level could complete building
the tar file
> while only omitting the unreadable files?  It seems to me that only
a try/except
> in the tarfile module could actually finish building the best
possible tar

I thought the code I posted would do that?

# open tarfile up here

for f in filelist:
   try: tarfile.TarFile.add()
   except OSERror: print 'couldn't add', f

# close tarfile down here


> Am I missing something?

Maybe, or maybe it's me that missing something?


Alan G.




More information about the Tutor mailing list