Python 3 SyntaxWarning: “is” used with literals (should be “==” instead)

829 viewsCSS BugsPython 3 SyntaxWarning
2

Hi,

CCS Version 2.9.0 – Ableton Version 12.1.11

I noticed that Control Surface Studio generates Python code for Ableton Live which triggers SyntaxWarnings during loading because of incorrect usage of is and is not with numbers (literals).

Log message:

/Applications/Ableton Live 12 Suite.app/Contents/App-Resources/MIDI Remote Scripts/css_touchosc_cptadapter_channelstrip_master_v2/css_touchosc_cptadapter_channelstrip_master_v2.py:1352: SyntaxWarning: “is” with a literal. Did you mean “==”?
/Applications/Ableton Live 12 Suite.app/Contents/App-Resources/MIDI Remote Scripts/css_touchosc_cptadapter_channelstrip_master_v2/css_touchosc_cptadapter_channelstrip_master_v2.py:1610: SyntaxWarning: “is not” with a literal. Did you mean “!=”?

For example, generated code contains:

if cnfg[“decimal_places”] is 0: –> should be if cnfg[“decimal_places”] == 0

if speed_to_max is not 0: –> should be if speed_to_max != 0

I’ve worked around the issue temporarily by fixing the generated Python manually, but it would be very helpful if this could be addressed in a future version of Control Surface Studio.

JohnC Answered question
0

Thanks, we thought we had caught them all, but clearly there still a few out there.

JohnC Answered question