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

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -