Hi to all,
I have created a simple Python script that reads data from an Excel file and uses this data to generate geometry in Rhino.
Because Rhino’s built-in Python environment cannot easily read .xlsx files, I switched to CPython and use the openpyxl library. The script works perfectly when I run it manually through:
Tools → PythonScript → Run
However, when I try to run the same script from a custom toolbar button/icon using:
!_-RunPythonScript "C:\Path\script.py"
the script fails.
After some testing, I found that the problem seems to be that the toolbar button launches the script using IronPython, which does not support the openpyxl library, while the script requires CPython.
Is there a recommended way to attach a CPython script (with external libraries such as openpyxl) to a custom Rhino toolbar icon?
Alternatively, is there a different command or workflow that allows a toolbar button to launch a CPython script instead of IronPython?
Any other suggestions?