Print function no longer works after some Grasshopper SDK calls

Hello developers @piac @DavidRutten,

Recently I have encountered the issue in Rhino Python Editor. So the issue is that my print command will not print content in the console screen (output tab), After some testing, it seems that it only happens to print commands after obj.ExpireSolution(True). gh.CloseAllDocuments() and gh.OpenDocument() may also affect the print function as well.

Another issue is that there are no varaibles stored in the Variables tab.

I do not know about the exact setup of that function, but I think that @stevebaer might know more precisely. Generally the print function fills the window via a callback, and that callback has to be set to a GH-specific value by GhPython. I think that was scope-specific but… I need to investigate this with Steve or possibly @Alain to tell more.

I added the RH-52397 report.

Generally, an ExpireSolution() from within a solution, or while a solution is running, is not accepted by Grasshopper.

1 Like

Hello @piac,

Thank you very much for creating the report. May I know if there is any workaround for now before this problem gets solved?



Any news on this? Did you guys find other workarounds? This continues to be a problem and makes debugging very messy.

Is it possible to print to a file or collect the printing result somehow to create a workaround?

@piac Could it be something like this?
TextLog.ToString method (

I used the following commands to write directly to the Rhino Command line:

The following line was possible to use in the ghpyton node to redirect the output to a text file.
sys.stdout = open(r"c:\temp\logfile.txt", “a”)

This way I could read the output from the file and redirect it to the Rhino console. For some methods like the the unittest module it was easier to collect the output directly.