Is there a way to really reset python3 in the script editor?
Reason:
If we change code in python vscode, we need to close rhino. After opening again it works.
Whereas Tools->Reset Python 3 does not do any change.
Any non standard solution would work for us too, to avoid restart of rhino.
I have the same problem with my C++ DLL in Visual Studio 2022. Once Rhino starts up and uses the DLL, I cannot recompile the DLL without restarting Rhino. Rhino puts a lock on the DLL file and will not release it without a restart. The lock prevents the build process from completing in VS as the last step of writing out the DLL is blocked.
I have endured this problem for the last 4 years. So if there is some way to release the file lock in Rhino without a restart, it would be much appreciated.
Because there is 8.5 service candidate only.
And currently Tools → Reset Python Engine has no effect.
I will try also the flag option. Issue is as always: development in vscode and running code in rhino.
That’s Windows / dotnet runtime behaviour. Once a dll is loaded the file is locked and can not be replaced or deleted. Unless the assembly is loaded from pure binary data which causes a bunch of other problems namely Assembly.Location would return empty.
@Petras_Vestartas It would be great if you can share instructions on how to repeat this problem. There has been no major change to the python runtime layout or pip version. When rhino installs a new python environment all the existing packages under site-envs are cleared so it is important to have package references inside scripts. That ensures they are reinstalled automatically.
Not sure if this is helping but I really have no idea what is your setup on your machine, what kind of libraries are you trying to reload, or what is your editable pip install package setup.
The wish is: I change code in VSCode and after I reset python engine of rhino I can run the code. Instead I need to restart rhino. I thought reset command would allow to use newly updated code without rhino restart.
Configuration: I have a conda environment with a simple compas package that is under development and pip editable install to rhino python script editor. Th example was compas_wood, no c++ code change only python.
Do you have any clue why these messages are not printed in Rhino ScriptEditor Terminal?
What is happening here is in C++ python binding printf() method called. It is super nice way to debug…
printf and other similar functions in C++ write to a known file handler named stdout (lets call this native stdout) that is automatically opened for every process, running from terminal , by the OS. So when you run your python program from the terminal , the resulting python process is bound to a stdout and all the outputs are captured and printed to the terminal window.
In a UI app like Rhino, the output printed to native stdout is not captured since the app is not bound to a terminal. You can run the macOS Rhino from the terminal and see the native output printed to the terminal window (Run the Rhinoceros.app/Contents/MacOS/Rhinoceros directly and not using open command otherwise the output will not be captured. You have to use Start-Process -Wait -RedirectStandardOutput command in Windows powershell)
When running a script from script editor, a new stream is created to represent stdout and is bound to the sys.stdout so all outputs from python scripts an be captured. When running Rhino normally and not using the methods described above, all the messages printed to the native stdout are skipped.