On 24 September 2012 02:22, Gregory Lund <gnj091...@gmail.com> wrote:


> > You're trying to open the directory as if it were a zipfile. You should
> > pass in the path to a zipfile not to a folder.
>
> Agreed, but how do I do that "pass in the path to a zipfile'?
> Using an if statement I presume?
>
> > >
> > > I guess my first issue is to resolve the 'Permission denied' problem.
> > > And, I know I need an 'if' statement, somehow...
> >
> Yes, the permission denied problem seems to be the first real
> obstacle, but I can't figure it out.
> I tried searching online but everything I found to try, didn't work.
>

The permission error is because you are trying to open a folder as if it
were a file. The operating system does not give you permission to do this
because it is a nonsensical operation.

> Remove the folder paths from the list of paths.
>
> How can I remove the folder paths from the list of paths?
>

You can do it with a list comprehension:

import os.path
paths = [p for p in paths if os.path.isdir(p)]

Oscar
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to