Tim Arnold wrote:
Hi, I don't even know what to google for on this one. I need to drive a commercial desktop app (on windows xp) since the app doesn't have a batch interface. It's intended to analyze one file at a time and display a report.

I can get the thing to write out the report an html browser, but I have thousands of files I need it to analyze every night.

Is there any lib or recipe(s) for doing something like this via python?

You are a little thin on details here. My only advice at this point is to check out os.system, which is the simplest option. From there you can move to the popen2 module for greater control, but if you are talking about a gui app, you may run into hang-ups.

A quick recipe would be the following pretend application that recursively descends from the current directory calling the utility named "dosapp" on every file it finds that ends with "jpg" (what "dosapp" does is left to your imagination):



import os

def doit(suffix, adir, filenames):
  for afile in filenames:
    if afile.endswith(suffix):
      pathname = os.path.join(adir, afile)
      os.system('dosapp %s' % pathname)


top = '.'
suffix = '.jpg'

os.path.walk(top, doit, suffix)


Read the docs on os.path.walk, of course.

James


--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095

http://www.jamesstroud.com
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to