Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Windows] Strings including unicode characters greater than 1 byte in length require user.paste #293

Closed
dannymcgee opened this issue Apr 23, 2021 · 1 comment

Comments

@dannymcgee
Copy link

dannymcgee commented Apr 23, 2021

Invoking a Talon script where the right hand side is a simple string including unicode characters which span more than one byte throws a TypeError: must be a unicode string of length 1. Wrapping the string with a call to user.paste works around the issue.

Repro

  1. Create a new Talon script in the user folder with the following content:
    emoji eyes: "👀"
  2. Open the Talon log
  3. Invoke the emoji eyes command
  4. Observe the error in the log

Full traceback

talon.scripting.talon_script.TalonScriptError:
 in script at C:\Users\danny\AppData\Roaming\talon\user\misc\emojis.talon:0:
 > auto_insert('👀')
TypeError: must be a unicode string of length 1
2021-04-23 11:05:29 DEBUG [~] C:\Users\danny\AppData\Roaming\talon\user\misc\emojis.talon
2021-04-23 11:05:53 ERROR    14: talon\scripting\talon_script.py:518|
   13: talon\scripting\talon_script.py:264|
   12: talon\scripting\talon_script.py:485|
   11:      talon\scripting\actions.py:74 |
   10:        talon\scripting\types.py:359|
    9:         talon\scripting\core.py:333|
    8:      talon\scripting\actions.py:74 |
    7:        talon\scripting\types.py:359|
    6:           talon_plugins\main.py:34 | actions.key(c)
    5:      talon\scripting\actions.py:74 |
    4:        talon\scripting\types.py:359|
    3:           talon_plugins\main.py:71 | ctrl.key_press(keyname, **kwargs)
    2:           talon\windows\ctrl.py:230|
    1:           talon\windows\ctrl.py:184|
TypeError: must be a unicode string of length 1


[The below error was raised while handling the above exception(s)]
2021-04-23 11:05:53 ERROR cb error topic="phrase" cb=<bound method SpeechSystem.engine_event of <talon.scripting.speech_system.SpeechSystem object at 0x000000000CBDF270>>
   30:                     threading.py:912 * # cron thread
   29:                     threading.py:954 *
   28:                     threading.py:892 *
   27:                    talon\cron.py:123 |
   26:                    talon\cron.py:83  |
   25:                     talon\vad.py:21  |
   24: talon\scripting\speech_system.py:303 |
   23:             talon\engines\w2l.py:1057|
   22:      talon\scripting\dispatch.py:103 |
   21:      talon\scripting\dispatch.py:138 |
   20:      talon\scripting\dispatch.py:129 |
   19:          talon\scripting\rctx.py:225 | # 'phrase' main:_redispatch()
   18: talon\scripting\speech_system.py:52  |
   17:      talon\scripting\dispatch.py:103 |
   16:      talon\scripting\dispatch.py:138 |
   15:      talon\scripting\dispatch.py:129 |
   14: -------------------------------------# cron thread
   13:          talon\scripting\rctx.py:225 | # 'phrase' main:engine_event()
   12: talon\scripting\speech_system.py:353 |
   11:       talon\scripting\actions.py:74  |
   10:         talon\scripting\types.py:359 |
    9:          talon\scripting\core.py:108 |
    8:       talon\scripting\actions.py:74  |
    7:         talon\scripting\types.py:359 |
    6:          talon\scripting\core.py:138 |
    5:       talon\scripting\actions.py:74  |
    4:         talon\scripting\types.py:359 |
    3:          talon\scripting\core.py:143 |
    2:  talon\scripting\talon_script.py:615 |
    1:  talon\scripting\talon_script.py:522 |
talon.scripting.talon_script.TalonScriptError:
 in script at C:\Users\danny\AppData\Roaming\talon\user\misc\emojis.talon:1:
 > auto_insert('👀')
TypeError: must be a unicode string of length 1
@lunixbochs
Copy link

fixed in beta

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants