I'm trying to run my test_script.py in main_script.py with subprocess. test_script.py is a siple sum program, and main_script.py should call it with 2 arguments, and catch output. Here is the code:
test_script.py
a = int(input())
b = int(input())
print(a+b)
main_script.py
import subprocess
subprocess.check_output(['python', 'test_script.py', 2,3])
This is the error im getting:
Traceback (most recent call last):
File "C:/Users/John/Desktop/main_script.py", line 2, in <module>
subprocess.check_output(['python', 'test_script.py', 2,3])
File "C:\Python34\lib\subprocess.py", line 607, in check_output
with Popen(*popenargs, stdout=PIPE, **kwargs) as process:
File "C:\Python34\lib\subprocess.py", line 858, in __init__
restore_signals, start_new_session)
File "C:\Python34\lib\subprocess.py", line 1085, in _execute_child
args = list2cmdline(args)
File "C:\Python34\lib\subprocess.py", line 663, in list2cmdline
needquote = (" " in arg) or ("\t" in arg) or not arg
TypeError: argument of type 'int' is not iterable