Repository: talonhub/community

Issue:
update_running_list() raising IndexError
I'm using this grammar with Conformer on Windows 10, in beta v0.2.0-114-g71c3. I'm frequently seeing errors like this in logs:

```
2021-10-02 17:37:32 ERROR cb error topic="app_close" cb=<function ui_event at 0x000000002D22C160>
   31:                                  threading.py:930| 
   30:                                  threading.py:973| 
   29:                                  threading.py:910| 
   28:                    talon\windows\winevents.py:144| 
   27:                   talon\scripting\dispatch.py:105| 
   26:                   talon\scripting\dispatch.py:144| 
   25:                   talon\scripting\dispatch.py:133| 
   24:                       talon\scripting\rctx.py:233| # 'app_close' main:dispatch()
   23:                   talon\scripting\dispatch.py:105| 
   22:                   talon\scripting\dispatch.py:144| 
   21:                   talon\scripting\dispatch.py:133| 
   20:                       talon\scripting\rctx.py:233| # 'app_close' main:_on_event()
   19:                           talon\windows\ui.py:73 | 
   18:                   talon\scripting\dispatch.py:105| 
   17:                   talon\scripting\dispatch.py:144| 
   16:                   talon\scripting\dispatch.py:133| 
   15: -------------------------------------------------# 'app_close' main:dispatch()
   14:                       talon\scripting\rctx.py:233| # 'app_close' user.knausj_talon.code.switcher:ui_event()
   13:            user\knausj_talon\code\switcher.py:353| update_running_list()
   12:            user\knausj_talon\code\switcher.py:183| running = actions.user.create_spoken_f..
   11:                    talon\scripting\actions.py:75 | 
   10:                      talon\scripting\types.py:366| 
    9: user\knausj_talon\code\create_spoken_forms.py:357| return actions.user.create_spoken_form..
    8:                    talon\scripting\actions.py:75 | 
    7:                      talon\scripting\types.py:366| 
    6: user\knausj_talon\code\create_spoken_forms.py:374| spoken_forms = actions.user.create_spo..
    5:                    talon\scripting\actions.py:75 | 
    4:                      talon\scripting\types.py:366| 
    3: user\knausj_talon\code\create_spoken_forms.py:317| spoken_forms_without_symbols = create_..
    2: user\knausj_talon\code\create_spoken_forms.py:237| spoken_form = create_spoken_form_for_n..
    1: user\knausj_talon\code\create_spoken_forms.py:107| words = [twenties[b2], ones[b1], t] + words
IndexError: list index out of range
```

I don't think this is related to any commands I'm using in Talon. I'm not actually using the running list commands.


Discussion:
@knausj85 guessing this is related to some of your final tweaks to spoken forms stuff? I remember you adding some stuff bout tens and twenties
@wolfmanstout - Any chance you can debug this a bit? I haven't seen this.

Potentially useful info would be: 
(1) What list(s) are the culprit? Have you significantly modified any of the number-related lists in numbers.py? There's some assumptions made
```
from .numbers import digits_map, teens, scales, tens
```

(2) What value(s) are passed to `create_spoken_form_for_number(...)`

Resolving patch:
diff --git a/code/create_spoken_forms.py b/code/create_spoken_forms.py
--- a/code/create_spoken_forms.py
+++ b/code/create_spoken_forms.py
@@ -49,14 +49,9 @@
     REVERSE_PRONUNCIATION_MAP[str(index)] for index in range(10) if index != 0
 ]
 
-# ["ten ", "eleven ",... "nineteen"] or equivalents
-teen = [tens[0]] + [val for val in teens]
-
-# print("tens = " + str(ten))
-
 # ["","","twenty","thirty","forty",..."ninety"]
 # or equivalent
-twenties = ["", ""] + [val for index, val in enumerate(tens) if index != 0]
+twenties = ["", ""] + [val for val in tens]
 # print("twenties = " + str(twenties))
 
 thousands = [""] + [val for index, val in enumerate(scales) if index != 0]
@@ -102,7 +97,7 @@ def create_spoken_form_for_number(num: int):
         if b2 == 0:
             words = [ones[b1], t] + words
         elif b2 == 1:
-            words = [teen[b1], t] + words
+            words = [teens[b1], t] + words
         elif b2 > 1:
             words = [twenties[b2], ones[b1], t] + words
         if b3 > 0:


Test patch: