I observed that I cannot run python scripts from a button, but I can when I run them from the Rhino Python Editor.
From the button, the command is as follows: ! _-RunPythonScript “some_script.py”. When I run it, I just get the following in the dialog: Python Script <some_script.py> ( ResetEngine ): “some_script.py”
Does someone know why it doesn’t run from the button?
Thanks in advance,
After I have cancelled the script while running it from the Rhino Python Editor, it now works from the button too. Very odd but works now
Did you modify your script in some way? I think IronPython stores the compiled scripts. When you run from a button it runs the last compiled version without checking for updates. When you run from the editor it recompiles the latest version and runs it. There are some tricks to work around this with the
reload() function which you will probably find searching this forum for button pyhon reload.
Thank you for your quick response.
No, I did not modify the script.
I looked at the reload() functionality, but I do not use another custom module, and also do not get an error regarding importing modules.
I restarted Rhino and checked again, and this “hack” seems to work for me:
- Run the command from the Rhino Python Editor
- Escape out of the command before finishing
Hope this helps and thanks again!