fixed STDOUT error
no files on command line translate to "filename" being empty list. Cannot test for filename[0] then...
This commit is contained in:
parent
5e1cac2e5e
commit
afff0b8614
|
@ -49,7 +49,7 @@ parser.set_defaults(right = (0.0,0.0,0.0))
|
||||||
(options,filename) = parser.parse_args()
|
(options,filename) = parser.parse_args()
|
||||||
|
|
||||||
if options.format not in outtypes:
|
if options.format not in outtypes:
|
||||||
parser.error('invalid format: "%s" (can be %s).'%(options.format,', '.join(outtypes)))
|
parser.error('invalid format: "{}" (choices: {}).'.format(options.format,', '.join(outtypes)))
|
||||||
|
|
||||||
if options.N < 2:
|
if options.N < 2:
|
||||||
parser.error('too few steps (need at least 2).')
|
parser.error('too few steps (need at least 2).')
|
||||||
|
@ -59,10 +59,9 @@ if options.trim[0] < -1.0 or \
|
||||||
options.trim[0] >= options.trim[1]:
|
options.trim[0] >= options.trim[1]:
|
||||||
parser.error('invalid trim range (-1 +1).')
|
parser.error('invalid trim range (-1 +1).')
|
||||||
|
|
||||||
|
name = options.format if filename == [] \
|
||||||
name = options.format if filename[0] is None\
|
|
||||||
else filename[0]
|
else filename[0]
|
||||||
output = sys.stdout if filename[0] is None\
|
output = sys.stdout if filename == [] \
|
||||||
else open(os.path.basename(filename[0])+extensions[outtypes.index(options.format)],'w')
|
else open(os.path.basename(filename[0])+extensions[outtypes.index(options.format)],'w')
|
||||||
|
|
||||||
colorLeft = damask.Color(options.colormodel.upper(), list(options.left))
|
colorLeft = damask.Color(options.colormodel.upper(), list(options.left))
|
||||||
|
|
Loading…
Reference in New Issue