Scripting Section for touchbar is toasted :(

Note: Before bug reporting, please make sure you have tried the latest (alpha) version of BetterTouchTool and that you have already tried to restart your system :-). If you encounter a crash, please attach a crash log from the macOS Console.app from the "User Diagnostic Reports" section.

Describe the bug
There are many issues with the scripting TextView. I believe it is not editing in UTF-8 mode.
As quite and double quotes are being replace with look alike but not right encoding counterparts.

However this bug ticket for this interesting case. This code runs fine in Visual Code or command prompt. end goal is along side cryptos current value I am putting the % of 24 hours

#!/opt/homebrew/bin/python3

import os
import json
from pycoingecko import CoinGeckoAPI

coin = os.getenv('COIN')
#coin = 'ethereum'
fiat = os.getenv('FIAT')
#fiat = 'usd'

cg = CoinGeckoAPI()
jsonData = cg.get_price(ids=coin, vs_currencies=fiat)
jsonDump = json.dumps(jsonData)

obj = json.loads(jsonDump)
output = obj[coin][fiat]


op = "{:.2f}".format(output)

#1 
print('${0} ( -2.99%)'.format(op))
# above line should print the result but it makes the touch button disappear. 

#2 
print('${0}'.format(op))
# this line print the value just fine. 

Affected input device Touch Bar

Screenshots
Not sure how to take screenshot of touch bar.

Device information:

  • Type of Mac: Apple Silicon M1
  • macOS version: 12.2.1
  • BetterTouchTool version: 3.756

Additional information (e.g. StackTraces, related issues, screenshots, workarounds, etc.):
There is no workaround that I have found if anyone have any please do let me know.

If you don't mind using an existing soution, I recommend to use Crypto-Touchbar-App (chrislennon.github.io)

Is it possible to know why this is happening?

Because I have tried existing scripts from Touch bar app.
I modify them and BTT breaks.

It's not that script is not producing the output.
If we run above script on command line. It prints out the perfect output.
Attaching screenshot of out put running the script. that BTT refuse to run.
Screen Shot 2022-05-03 at 7.40.05 PM

I am trying to make some scripts that is customized to my needs.
For example. I am trying to do the ETH gas tracker free API give me 2 calls per second. It perfect to have right in the touch bar but some how other than some specific outputs. BTT is toasted.

Other than suggesting the tool. Do you know any other workaround so that I can make my script run.

let me correct myself. it actually make that button disappear.

PS: While I wrote everything. It occur to me. Do you think it is due to because I need to make other printable characters escaped.

I hope you might have any pointers for me. I know you are busy and single handedly wrote this amazing tool.
if you can debug and see what is happening in the code. That would be the huge help for me.

Best,
Alok C