[Tutor] Cannot fix OSError

Nick Lunt nick at javacat.f2s.com
Sat Jan 31 10:11:50 EST 2004


Many thanks for your responses.

On Fri, 30 Jan 2004 18:26:10 -0800 (PST)
Danny Yoo <dyoo at hkn.eecs.berkeley.edu> wrote:

> Oh!  Here is one possibility: the files listed in sys.argv[2:] may be
> directories.  It's possible that tarfile.TarFile.add() can take in either
> directories or filenames.  That is, the directory
> 
>     /etc
> 
> might be listed in sys.argv[2:], and technically speaking, '/etc' is
> completely readable.  But if tarfile recursively dives into a directory,
> it might run into:
> 
>     /etc/skel/tmp
> 
> and run into problems tarring that file.  The test for readability in the
> code you've written only looks at the files explicitely listed on the
> command line.

I think my main error is as Danny Voo states, the fact that I sent in /etc which can be read fine, but some files beneath it can't. Thanks for that Danny, now I've seen how you've done it I'll try not to look at it again so I can try it myself ;) And thanks for the links too.

On Sat, 31 Jan 2004 09:01:38 -0000
"Alan Gauld" <alan.gauld at blueyonder.co.uk> wrote:

> What's wrong with a try/except approach:

Alan, I agree the try/except method would help, but I wanted to understand why my if statement wasn't working 100%, the final version of my prog will include several try/except blocks

On Sat, 31 Jan 2004 04:44:49 +0100
jb <jb at riseup.net> wrote:

> basically you can't tar a directory that doesnt have r and x fields set 

Thanks jb, I understand the unix permissions and thought my if block would filter out that problem, but obviously I didn't think about it hard enough ;)

Anyway, thanks again for all your help.

Cheers
Nick.



More information about the Tutor mailing list