Carlos:

Thank you for your response.  

It turns out that Python and os.path.isfile() are working as expected.
A permissions conflict on my Linux-based system caused the isfile
function to return false for all the entries in the directory.  The web
server is running as user apache.  The files were owned by user iip.  I
don't have all the details worked out yet, but it appears that adding
apache to iip's group list resolves the conflict.  

It would be nice if the library entries for os.path.is* (where * is one
of {file, dir, link, mount) mentioned this restriction.

Regards,
 
Barry
[EMAIL PROTECTED]
541-302-1107
________________________
We who cut mere stones must always be envisioning cathedrals.

-Quarry worker's creed

> -----Original Message-----
> Date: Fri, 2 Jun 2006 23:28:21 -0700
> From: "Carlos Daniel Ruvalcaba Valenzuela" <[EMAIL PROTECTED]>
> Subject: Re: [Tutor] Trouble with os.path.isfile
> To: tutor@python.org
> Message-ID:
>       <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset=WINDOWS-1252; format=flowed
> 
> From: Carlos Daniel Ruvalcaba Valenzuela <[EMAIL PROTECTED]>
> Date: Jun 2, 2006 11:10 PM
> Subject: Re: [Tutor] Trouble with os.path.isfile
> To: "Carroll, Barry" <[EMAIL PROTECTED]>
> 
> 
> Here is the problem IMO:
> 
> I did some modifications to your code (very minimal on ifs) and it
worked:
> 
> import os
> 
> def lstdirsnfiles(tdir):
>     flst = os.listdir(tdir)
>     flst.sort()
> 
>     fnames = []
>     dnames = ['.', '..']
> 
>     for name in flst:
>         absfn = os.path.join(tdir, name)
> 
>         if os.path.isdir(absfn):
>             dnames.append(name)
> 
>         if os.path.isfile(absfn):
>              fnames.append(name)
>     return (dnames, fnames)
> 
> (dirs, files) = lstdirsnfiles('/home/clsdaniel')
> 
> It returns correctly all directories and files.
> 
> Regards
> Carlos Daniel Ruvalcaba Valenzuela
<<snip>>


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to