AnsweredAssumed Answered

Run Process in Many Directories

Question asked by jehall on Jan 18, 2012
Latest reply on Jan 20, 2012 by jehall
I have written a python script that will run a set of processes in a directory that contains data and outputs results for that data in this directory as well.  My problem is that I do not have a good way of scripting the list of directories for two reasons.
One ??? the path contains spaces.  I know.  Lets not go there.
Two ??? there are 250 of them.

This is what I am doing but it is pretty lame.

       StreamName = "Waller Creek Trib 4"        ProcessDEM(StreamName)                StreamName = "Waller Creek Trib 3"        ProcessDEM(StreamName)                StreamName = "Waller Creek Trib 2"        ProcessDEM(StreamName)                StreamName = "Waller Creek"        ProcessDEM(StreamName)


I have tried reading a text file but the code does not work:

        f = open('test.txt')         for line in f:             StreamName = line,             ProcessDEM(StreamName)


Produces an error for every line:
cannot concatenate 'str' and 'tuple' objects

And the nearly same code:

        f = open('test.txt')         for line in f:             StreamName = line             ProcessDEM(StreamName)


Only runs the LAST line of my text file because py reads in the carriage return for all other lines and my paths are messed up.  Anyone have a better way of reading a list of hundreds of paths to data to process?

Outcomes