I was testing a simple command that looks like this Python 2.py 1 2
here is what I tried:
from subprocess import call
file = r"C:\Users\RANIA\Desktop\2.py"
x = 1
y = 2
call(["python"+ " " + file + " " + str(x)+ " " + str(y)])
and the contents of the 2.py file are:
import sys
def hello(a,b):
print "hello and that's your sum:", a + b
if __name__ == "__main__":
a = int(sys.argv[1])
b = int(sys.argv[2])
hello(a, b)
I’m getting this error:
Runtime error (Win32Exception): WindowsError
Traceback:
line 877, in _execute_child, "c:\Program Files\Rhinoceros 5 (64-bit)\Plug-ins\IronPython\Lib\subprocess.py"
line 488, in call, "c:\Program Files\Rhinoceros 5 (64-bit)\Plug-ins\IronPython\Lib\subprocess.py"
line 6, in script
line 669, in __init__, "c:\Program Files\Rhinoceros 5 (64-bit)\Plug-ins\IronPython\Lib\subprocess.py"
Also, I have another question that is related, how do I tell grasshopper to check and see if the python file is executed and bring the results back into grasshopper ?