[3050] My old script no longer works (setCustomParameter_forKey_)

I tried to run an old script that I used to automate the writing of custom parameters for my Quinoa typeface. It’s supposed to replace glyphs with their .ss02 version wherever possible. I’m pretty sure this is an extensively modified version of a script Rainer originally wrote for Traction, since I personally can’t python my way out of a paper bag.

When I run it now, I get the following error message:

This script definitely used to work*, but now apparently this method for setting custom parameters in an instance no longer exists. What’s the new way of doing this?

*) I did run futurize over it. I wonder whether that screwed it up. It won’t run with Glyphs 2 anymore, either.

Or did I actually fail to apply futurize correctly? I think I used $ futurize -1 -w FILENAME.py like in the tutorial. After that, futurize didn’t have anything to complain about anymore.

The easiest would be to replace

setCustomParameter_forKey_

with

setCustomValue_forKey_

Or use the proper API and replace the whole line with:

thisInstance.customParameters[renameGlyphsParameterKey] = renameGlyphs1+renameGlyphs2

And the next time, paste the code (between lines that only contain three grave (backticks) ```)

1 Like

That worked! :smiley: Thanks for the superfast reply!

And thanks for the tip on pasting code, I’m sure I’ll have more of those in the future. :wink: