Previously I asked a question here. That problem solved but there are error while developing the script.
Currently, an option is obtained from command line like:
... -b b1
the code processing that is:
import Mybench, optparse
parser.add_option("-b", "--benchmark", default="", help="The benchmark to be loaded.")
if options.benchmark == 'b1':
process = Mybench.b1
elif options.benchmark == 'b2':
process = Mybench.b2
...
else:
print "no such benchmark!"
Now I have changed so that more than one option is passed to "-b".
... -b b1,b2
The code for this is:
process = []
benchmarks = options.benchmark.split(',')
for bench_name in benchmarks:
print bench_name
process.append(Mybench.bench_name)
If you notice, in the first code the process gets value like this:
process = Mybench.b1
Now I write this:
process.append(Mybench.bench_name)
I expect that this command line:
... -b b1,b2
results in:
process[0] = Mybench.b1
process[1] = Mybench.b2
However I get this error:
process.append(Mybench.bench_name)
AttributeError: 'module' object has no attribute 'bench_name'
Is there any solution to that?