fscked <[EMAIL PROTECTED]> writes:

> I cannot seem to get this to work. I am hyst trying to read in a list
> of paths and see if the directory or any sub has a filename pattern.
> Here is the code:
>
> import os, sys
> from path import path
>
> myfile = open("boxids.txt", "r")
> for line in myfile.readlines():

Instead of this:

>       d = path(line)

try this:

        d = path(line.strip())

``readlines`` doesn't remove trailing newline characters from string

>       for f in d.walkfiles('*Config*.xml'):
>               print f
>
> And here is my error:
>
> Traceback (most recent call last):
>   File "Untitled.py", line 21, in ?
>     for f in d.walkfiles('*Config*.xml'):
>   File "C:\Python24\Lib\site-packages\path.py", line 460, in walkfiles
>     childList = self.listdir()
>   File "C:\Python24\Lib\site-packages\path.py", line 328, in listdir
>     names = os.listdir(self)
> WindowsError: [Errno 3] The system cannot find the path specified: u'X:
> \\Instructions\\97544546294\n/*.*'
>

-- 
HTH,
Rob
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to