combining the path and fileinput modules

Gabriel Genellina gagsl-py at yahoo.com.ar
Sat Nov 25 07:46:15 CET 2006


At Saturday 25/11/2006 00:14, wo_shi_big_stomach wrote:

> > The filter should be applied to walkfiles. Something like this:
> >
> > dir = path(/home/wsbs/Maildir)
> > for f in filter(os.path.isfile, dir.walkfiles('*')):
> >         #
> >         # test:
> >         # print f
>
>Thanks, this way f will print the full pathname/filename. But f already
>does that using Jason Orendorff's path module:
>
>dir = path('/home/wsbs/Maildir')
>for f in dir.walkfiles('*'):
>         print f

The filter is used to exclude directories. fileinput can't handle directories.

>At this point I believe the error has to do with fileinput, not the path
>or os.path modules.
>
>If I give fileinput.input() a hardcoded path/filename in place of 'f'
>the program runs. However the program will not accept either f or 'f' as
>an argument to fileinput.input().

Tried with (f,) ?
Notice that *this* error is not the same as your previous error.


-- 
Gabriel Genellina
Softlab SRL 

__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis! 
¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar



More information about the Python-list mailing list