argument_list = ['name=Jon', 'id=100' ] output = subprocess.check_output( ['/usr/bin/python', 'test.py', argument_list ], stderr=subprocess.STDOUT) In simple terms, I am trying to invoke a script using subprocess called test.py; I want to pass arguments to test.py through a list. Importatnt - List can be of any size.
Things I tried ,
output = subprocess.check_output( ['/usr/bin/python', 'test.py', ", ".join(argument_list) ], stderr=subprocess.STDOUT) and
output = subprocess.check_output( ['/usr/bin/python', 'test.py', '%s' % argument_list ], stderr=subprocess.STDOUT) Neither works because in subprocess.checkoutput should be (' ', ' ' ,' ') etc....
Is there a better way to do this ?