[FWTools] Python "batch" processing
nlneilson
neilnln at hotmail.com
Fri Feb 26 01:16:27 EST 2010
Here is the Python code.
This just does the pct2rgb, no clip necessary.
This also makes the .bat file.
I will look at the doc for 'os.popen()', maybe I can find an example in .py
that uses this in a similar way.
How is the 'os.popen()' implemented in a .bat file?
[code]
import os
import sys
import math
import time
from time import gmtime, localtime, strftime
infname = "Alaska_Orig.txt"
print infname
outfname = "Alaska.bat"
print outfname
def clip_charts():
inf = file(infname, 'r')
outf = file(outfname, 'w')
while inf:
ln = inf.readline()
if ln=="": break
lnsp = ln.split(',', 4) # split file
if len(lnsp) == 2:
fname = lnsp[0]
proc_2rgb = "pct2rgb" + " \"Alaska\\" + lnsp[0] + "\" " + "
Work\\Alaska\\" + lnsp[1]
print proc_2rgb
outf.write(proc_2rgb)
inf.close()
outf.close()
#-----main
if __name__ == "__main__":
# sys.exit(main())
t0 = time.clock()
strt = 0
#change()
clip_charts()
t2 = time.clock()
print ' Ran for', int(t2-t0), 'sec.'
# raw_input("Press Enter to exit:")
[/code]
--
View this message in context: http://old.nabble.com/Python-%22batch%22-processing-tp27714398p27714922.html
Sent from the FWTools mailing list archive at Nabble.com.
More information about the FWTools
mailing list