Use of cpython when using a button as trigger

Hi there

I want to use a python script via a button in rhino. As the button command I use

! _-RunPythonScript “C:\Users\anhmba\OneDrive - Ancotech AG\rs_QR_Code.py”

The python script I use has to utilize cpython and not ironpython because it is using 2 external libaries: pillow and pylibdmtx.

It creates the following error (german)

So I asume the button command uses the ironpython engine as default and I am wondering how to change this to the cpython engine. When I go in the Edit Script command and run the code from there it works - it is only the button that seems to use the ironpython engine. I put the script in the annex.

Thank you for your help.

Kind regards

Mirko

rs_QR_code.py (7.0 KB)

Hi Mirko, try to explicitly set the Python version in the .py file (i.e. add #! python 3 as the first line).

And welcome on board :slight_smile:

2 Likes

Hi Anders

thank you so much for your quick reply - it’s working perfectly, sometimes the solution is so easy :slight_smile:

Have a good day & kind reagards

Mirko

2 Likes