talonhub / community

Voice command set for Talon, community-supported.
MIT License
618 stars 768 forks source link

dictation not working on recent commits #922

Closed colings86 closed 2 years ago

colings86 commented 2 years ago

Commits after b26bf15ee1fb0b5feb6846d6e8077d8ee6cc9028 on the main branch cause all dictation (say command, formatters and dictation mode) to not work for me using Talon 0.3.0 on a Mac M1. The talon.log file shows the following error when talon starts up. Checking out commit b26bf15ee1fb0b5feb6846d6e8077d8ee6cc9028 directly makes dictation work and does not show the error on startup but the (currently) three commits after that on main do not work for me.

Note that another user has also reported seeing this on the Talon Slack chat (https://talonvoice.slack.com/archives/C7ENXA7C4/p1658075312159609?thread_ts=1658061197.879179&cid=C7ENXA7C4).

2022-07-17 16:58:13 ERROR user.knausj_talon.code.vocabulary: action dictate.replace_words() failed type check
   20:  lib/python3.9/threading.py:937* # loader thread
   19:  lib/python3.9/threading.py:980* 
   18:  lib/python3.9/threading.py:917* 
   17:     app/resources/loader.py:827| 
   16:     app/resources/loader.py:771| 
   15: talon/scripting/registry.py:193| 
   14: talon/scripting/registry.py:204| 
   13: talon/scripting/dispatch.py:105| 
   12: talon/scripting/dispatch.py:144| 
   11: talon/scripting/dispatch.py:135| 
   10:     talon/scripting/rctx.py:233| # 'update_decls' main:update_decls()
    9:    talon/scripting/scope.py:150| 
    8:    talon/scripting/scope.py:131| 
    7: talon/scripting/dispatch.py:105| 
    6: talon/scripting/dispatch.py:144| 
    5: talon/scripting/dispatch.py:135| 
    4:     talon/scripting/rctx.py:233| # 'change' main:_registry_update_contexts()
    3:    talon/scripting/scope.py:55 | 
    2: talon/scripting/registry.py:455| # [stack splice]
    1:    talon/scripting/types.py:196| 
talon.scripting.types.ActionImplError: Function 'dictate.replace_words' incompatible with prototype 'dictate.replace_words'
  Signature: (words: collections.abc.Sequence[str]) -> collections.abc.Sequence[str]
  Expected:  (words: Sequence[str]) -> Sequence[str]
  - Parameter 'words' type annotation does not match prototype. Found 'collections.abc.Sequence[str]', expected 'Sequence[str]' (or no annotation)
  - Return type mismatch. Found 'collections.abc.Sequence[str]', expected 'Sequence[str]' (or no annotation)
2022-07-17 16:58:15  INFO (SpeechSystem) Activating speech engine: W2lEngine(fast Conformer b108 (2021-09-15))
2022-07-17 16:58:15 DEBUG Dispatched launch events at 1.4764s, done at 2.7376s
2022-07-17 16:58:15 ERROR [!] 2 error(s) during startup (shown earlier in log)
colings86 commented 2 years ago

It seems that this commit (2bafd31d) might be the cause since it seems to add the collections.abc.Sequence that the talon error above mentions

colings86 commented 2 years ago

Reverting the commit mentioned above locally also solved the issue. Not that I'm suggesting that should be the fix here, only that this indicates that particular commit seems to be the cause.

lunixbochs commented 2 years ago

See also:

https://github.com/knausj85/knausj_talon/issues/816 https://github.com/knausj85/knausj_talon/pull/918#discussion_r920003088

Please remove pyupgrade from the knausj_talon process and revert any typing changes for now until I have official advice on this.

In general, pyupgrade seems like it's a bad idea to run automatically on talon repos. Any syntax upgrades should be intentional and measured.

rntz commented 2 years ago

This should be fixed now. If you could confirm it works for you that would be great.

colings86 commented 2 years ago

Thanks for the super quick fix. I can confirm that the latest main commit works for me.