Re: [Tutor] Scan Directory for files

2008-08-02 Thread Steve Poe
Fred, What is/are the exact error message(s)? You may want to look at the module glob. Steve Ar e you typing this in the python interpreter or On Aug 1, 2008, at 10:41 PM, Fred @ Mac wrote: Hello, new to python, so please go easy on me! I am using for f in os.listdir(watch_dir):

Re: [Tutor] Scan Directory for files

2008-08-02 Thread Alan Gauld
Fred @ Mac [EMAIL PROTECTED] wrote for f in os.listdir(watch_dir): tree = ET.parse(f) for shot in tree.findall('Shot'): ..do stuff.. But my script fails if, for example, a directory also exists in watch_dir Take a look at os.walk which allows recursive traversal of a

Re: [Tutor] Scan Directory for files

2008-08-02 Thread Kent Johnson
On Sat, Aug 2, 2008 at 1:41 AM, Fred @ Mac [EMAIL PROTECTED] wrote: Hello, new to python, so please go easy on me! I am using for f in os.listdir(watch_dir): tree = ET.parse(f) Should be ET.parse(os.path.join(watch_dir, f)) I think... for shot in tree.findall('Shot'):

[Tutor] Scan Directory for files

2008-08-01 Thread Fred @ Mac
Hello, new to python, so please go easy on me! I am using for f in os.listdir(watch_dir): tree = ET.parse(f) for shot in tree.findall('Shot'): ..do stuff.. to scan a directory for specific files (xml files specifically). But my script fails if, for example, a