Thanks for your help so far. It took me a while, but I finally got around to working on this project.
I’m experimenting with running a python script from C# in Grasshopper, which seems to work (ExecuteFile returns True).
However, I’m struggling to understand how to input/output with that script. Here’s my C# code so far:
string path = “C:\python_hello.py”;
Rhino.Runtime.PythonScript rbfopt = Rhino.Runtime.PythonScript.Create();
object output = rbfopt.GetVariable(“hello”);
python_hello.py looks like this:
hello = “Hello Thomas!”
Now, I’d expect “Hello Thomas!” as an output, but I get “blank”.
So, if I run a file, (how) can I access its variables? Alternatively, can I somehow “print” some output?
I guess I can always read and write *.txt files, but I’m hoping that there’s an easier way.