And… slow loading of script editor after installing latest update (maybe just me??)
Here’s the link where I found the missing brackets. Some sort of formatting quirk:
There are definitely more because AI is grabbing/copying the lines with missing brackets.
Also there’s an error that you’ll encounter the second time running this code (works perfect first time). Figuring this out will help me because I’ll eventually have to figure out how to remove/delete sticky’s.
Traceback (most recent call last):
File “file:///C:/Users/kfran/.rhinocode/stage/rozre5ym.mf5”, line 60, in
File “file:///C:/Users/kfran/.rhinocode/stage/rozre5ym.mf5”, line 49, in mouse_event_helper_func
AttributeError: ‘__Py2StickyWrapper’ object has no attribute ‘Remove’
That code sample dates from 2019, so will have been written for Iron Python (Python 2), not Python 3. Python 2 didn’t need brackets for print commands.
Thanks!! And wow! That’s a pretty big change from 2 to 3. This will help me fix AI confusion as well as I’ve been wondering where it’s getting its mistakes from - it mixes up Python 2/3 quite a lot.
Yeah, the print one is the obvious one but I’m sure there are more obscure hurdles as well. Just keep in the back of your mind to check how old a code sample is if it doesn’t do what you anticipate - and then have a rigorous testbed ready to help sort it out!
The script editor allows for rapid testing - that helps a ton! What I have in my head right now is to do preliminary development with Python then eventually build plugins with C#. I have no idea how to compile Python as of yet.
I first learnt Python somewhere within Python 2’s lifespan. I ditched it early on and started learning C# (then kind of took a break from that too). I’m getting back into it at somewhat of a strange time as the changes between 2 and 3 are quite substantial. It’s not worth completely re-learning Python so I’ll have to roll with the punches and deal with these things as they appear. Just knowing that things like the ‘missing’ brackets are relating to Python 2 code goes a long ways because when I first started I had no idea of the nature of these issues. Thanks again for pointing that out!!
The AI can really help with getting back into code - it sucks when you know most of the syntax but little things here and there are forgotten. Even if the AI code is broken it helps jog the memory in lots of areas.