RunPythonScript error in wip? Solved

For some reason the latest wip has issues running RhinoScripts from buttons. Try this:

! -_RunPythonScript (
print int(len([1,2,3])/2)

It used to work just fine.

(The above example is very simplified and created to throw the same error as I get in the code I actually use)

Hey Jørgen, seems to be working here in latest (16.02) WIP… (answer: 1)


Works here too - from a new button.

Huh… you are right, but it doesn’t work after I have ran another script on a button. So something gets stuck in the lastest wip. I don’t know what that can be as this worked a few days ago.

Also notice the little blue “i”
I have no idea what that is representing.

Well, I’ll bugtrack it later.

I saw that blue “i” here as well but didn’t think more of it.

Now restarting RH6 and calling Toolbar to show that button again I see the “i” again. After another command, that disappears but after running that code from that button it reappears. Changing to another program and back makes it disappear - but not always…

I always see this (the little bar after Command:) - just running regular commands. Sometimes it’s just a point, sometimes a bar, but it’s pretty much always there. However seems like it used to be black, now it’s blue, but that might be the AA at work…


Hi Jorgen - what does the command history for this operation look like? Any clues there?


I have to run, but I did a quick test, the script worked fine, but if I first ran this:

! -_RunPythonScript (

import rhinoscriptsyntax as rs

int=rs.GetInteger(“Box Grid number:”,number=3,minimum=1)

rs.Command("_MeshBox XFaceCount="+str(int)+" YFaceCount=" +str(int)+" ZFaceCount="+str(int))


Then the other tosses the error.
I’ll see if I can help out some more in narrowing it down later tonight.

After ran once the other will not run correctly no matter what i do until I restart WIP.

Hi Jorgen - I see that error now - thanks. I think it’s from using ‘int’ as a variable - that is also a function. It seems OK if I change the name of ‘int’ in the first script and then run one after the other - in a fresh Rhino session after seeing the error.


Thanks. The odd thing is that it worked just fine in the previous build, so any idea why it get’s stuck in the “system”?

Hi Jorgen - no idea, but it does not work in V5 with ‘int’ as the variable. Same error message.


Well as everything in Python is an object, doing something like

int=rs.GetInteger("Box Grid number:",number=3,minimum=1)

assigns that particular function to “int” for that session, as a result, the int native function no longer works - because when you call it, it will try to run your newly assigned function on whatever argument you feed to it. Any internal functions that depend on int will also fail.

So the general rule in Python is never use any of Python’s internal methods as a variable name. i.e. avoid variable names that are any of these

If it worked in the past, you may have just gotten lucky, but as a general rule, this is a no-no…


1 Like

That is one reason why i´ve been asking for a better syntax highlighting in the Python editor. Python has so many keywords, built in function and method names, it is almost inevitable that existing ones are unintentionally used as variable names, when lowercase is used.

CamelCase in conjunction with klingon variable names rocks :wink:

lupDujHomwIj luteb gharghmey !


1 Like

I had no idea it affected anything outside the script while or after running, thanks for the heads up!