J
John Leslie
I am porting a script from Korn Shell to python and want to pass named
parameters like -JOB 123456 -DIR mydir
I can get it to work passing --JOB and --DIR but not -JOB and -DIR
Any ideas?
Current code :
try:
options, xarguments = getopt.getopt(sys.argv[1:], '', ['JOB=',
'DIR=', 'ERR=', 'GRP=', 'TST=', 'JNM=', 'DAT=',])
except getopt.error:
print 'Error: You tried to use an unknown option'
sys.exit(1)
JOB = ''
for o,a in options[:]:
print 'here2'
print o
print a
if o == '--JOB':
JOB = a
print JOB
parameters like -JOB 123456 -DIR mydir
I can get it to work passing --JOB and --DIR but not -JOB and -DIR
Any ideas?
Current code :
try:
options, xarguments = getopt.getopt(sys.argv[1:], '', ['JOB=',
'DIR=', 'ERR=', 'GRP=', 'TST=', 'JNM=', 'DAT=',])
except getopt.error:
print 'Error: You tried to use an unknown option'
sys.exit(1)
JOB = ''
for o,a in options[:]:
print 'here2'
print o
print a
if o == '--JOB':
JOB = a
print JOB