[issue24428] Import sys,getopt is having issue while taking inputs
venkata suresh gummadillli
report at bugs.python.org
Wed Jun 10 21:42:08 CEST 2015
New submission from venkata suresh gummadillli:
[@outsidetried ~]$ python validate_json_adj.py
[@outsidetried ~]$ python validate_json_adj.py -h
validate_json.py -i <input_file>
[@outsidetried ~]$ python validate_json_adj.py -i hello.txt
Input JSON file provided for verification: hello.txt
[@outsidetried ~]$ python validate_json_adj.py -i firstfile
Input JSON file provided for verification: firstfile
[@outsidetried ~]$ python validate_json_adj.py -i <hello.txt>
-bash: syntax error near unexpected token `newline'
[sureshgv at outsidetried ~]$ python validate_json_adj.py -i ??
Input JSON file provided for verification: ci
[@outsidetried ~]$ python validate_json_adj.py -i ???
Input JSON file provided for verification: bf1
[@outsidetried ~]$ python validate_json_adj.py -i $#@%
Input JSON file provided for verification: 0@%
[@outsidetried ~]$ cat validate_json_adj.py
#!/usr/bin/python
"""
"""
import sys,getopt
"""
"""
def main(argv):
inputfile = ''
try:
opts, args = getopt.getopt(argv,"hi:",["input_file="])
except getopt.GetoptError:
print 'validate_json.py -i <input_file>'
sys.exit(2)
for opt, arg in opts:
if opt == '-h':
print 'validate_json.py -i <input_file>'
sys.exit()
elif opt in ("-i", "--input_file"):
inputfile = arg
print 'Input JSON file provided for verification:', inputfile
if __name__ == "__main__":
main(sys.argv[1:])
----------
components: Library (Lib)
messages: 245142
nosy: venkata suresh gummadillli
priority: normal
severity: normal
status: open
title: Import sys,getopt is having issue while taking inputs
type: behavior
versions: Python 2.7
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24428>
_______________________________________
More information about the Python-bugs-list
mailing list