Script editor changing normal quotes to "curly" (unicode) quotes

Describe the bug
Originally noticed this when editing a Python script. It was doing something weird with quoted strings, where the cursor keeps moving outside of the quote and possibly inserting some invisible characters or something? I type just one character, see the cursor jump, and then if I try to run the script I get "SyntaxError: EOL while scanning string literal"

See followup post for more details

Device information:

  • Type of Mac: 2019 MBP
  • macOS version: 10.15.7
  • BetterTouchTool version: (please post the exact version - not just "the latest one") 3.560 (1700)

@Andreas_Hegenberg it looks like the built-in editor changes normal double quotes (") to curly quotes () when making changes to scripts. this seems like a pretty bad bug and it was happening in Catalina and now on a brand new install of Big Sur

  • Type of Mac: 2019 MBP
  • macOS version: 11.4
  • BetterTouchTool version: (please post the exact version - not just "the latest one") 3.570 (1710)

Which type of script are you editing?

I currently can't seem to reproduce this, but you can disable this system wide if you want (System Preferences => Keyboard):

1 Like

thanks for getting back to me. it was happening with a bash script executing python (the source of the python script is the Crypto-Touchbar-App tool)

disabling it system-wide does indeed prevent the issue. apparently when it's enabled, the system will replace the nearest quote in whatever text is being edited (so it actually changes parts of the text that weren't typed!)

this doesn't happen in TextEdit, but it does in Notes... so there's probably some kind of flag or input "type" that the behavior applies to? (it seems like MacOS treats the BTT script text field as something other than plain text)

An EOL while scanning string literal error indicates that the Python interpreter expected a particular character or set of characters to have occurred in a specific line of code, but that those characters were not found before the end of the line . This results in Python stopping the program execution and throwing a syntax error . In most cases, this is due to the following reasons:

  • Missing quotes
  • Strings spanning multiple lines

Strings can't normally span multiple lines. If you don't want the string to appear on multiple lines but you want to initialize it on multiple lines (so you can read it more easily), you can "escape" the newline by putting a backslash before the newline. If you want it to appear on multiple lines, you can use triple quotes around the string.