Vote count:
0
This is a snippet from a code written by my colleague. The code is for making a argument parser in python for some purpose.
if not sys.stdin.isatty():
# Running in pipe mode
pipe_mode = True
else:
opts.add_argument('address', nargs='+')
What is happening is if we pipe stdin its not reading it. This is what I am trying to do:
subprocess.Popen(["nomadly-geocode", "-o", "json", values[1]],
stdout=subprocess.PIPE)
Since I am PIPE-ing stdout it should be working. But I am getting this error where it is not able to identify the arguments. ( The function works fine if we use command line to run it)
error:(lets say values[1] = Sydney)
usage: nomadly-cli-geocode [-h] [-o {parse,json,human}] [-u]
nomadly-cli-geocode: error: unrecognized arguments: Sydney
asked 41 secs ago
python: stdout PIPE on argparse not working
Aucun commentaire:
Enregistrer un commentaire