In the parent directory O, I have a series of directories Aa, where a varies from 0-1. In each of these I have a series of directories Bb, where b varies from 0-1. In each of these there are the input/output files AaBbCc.dat and AaBbCc.out for some calculations [c also varies from 0-1]. However, due to a limit on the amount of resources I can use some of these calculations failed to complete (or even run).
I have created a file 'walltime.txt' which lists the output files [AaBbCc.out] that have closed prior to the calculation finishing. It is from here that the variables a, b and c take there values.
I am trying to write a program which, overall takes the names of the files that haven't completed, works out the names of those that haven't run and writes all of these into a batch file.
i.e.
The filename A0.8B0.6C0.9.out appears in 'walltime.txt'.
As such: inp = A0.8B0.6C0.9.dat; outp = A0.8B0.6C0.9.out; a = 0.8; b = 0.6 and c = 0.9 The list GULP is then formed: GULP = ['gulp < ' + inp + ' > ' + outp]
N.B. As I will want to add to this, I am assuming it cannot just be a variable, but a one item list.
In order to work out if there are any files in the directory that haven't run, I need to do the following [which was the original post]:
When c does not equal 1.00, extend the list GULP to include gulp < ' + AaBbCc.dat + ' > ' + AaBbCc.out. This must always happen, except when a == 0.3 and b == 0.2 and when a == 0.8 and c == 0.6.
Does this actually make any logical sense?
If so, how do I go about implementing such a piece of code in python 3: I know I am going to need an if loop for the first bit, but am unsure as to how to build in the exception.
I found literature on 'except', but this seemed to be more designed for a 'trial and improvement' methodology, and about catching errors that occur in programs. Would it still be possible for me to implement the except function?