subprocess - How to receive the arguments in python sub process runable file -
subprocess.popen(['python', downloadscript.py, "--longitude", long, "--latitude", lat, "--download_to", ],stdout=subprocess.pipe)
i want longitude
, latitude
, download_to
in downloadscript.py
file
the pythonic way parse arguments in python module argparse
:
import argparse parser = argparse.argumentparser() parser.add_argument("longitude", help="enter longitude") parser.add_argument("latitude", help="enter latitude") parser.add_argument("download_to", help="target directory") args = parser.parse_args() latitude = args.latitude
read more here: https://docs.python.org/2/howto/argparse.html
Comments
Post a Comment