Describe the bug
While generating crosswords in Pyodide, an exception rises sometimes:
Uncaught (in promise) PythonError: Traceback (most recent call last):
File "/lib/python311.zip/_pyodide/_base.py", line 540, in eval_code_async
await CodeRunner(
File "/lib/python311.zip/_pyodide/_base.py", line 365, in run_async
await coroutine
File "<exec>", line 8, in <module>
File "/lib/python3.11/site-packages/platyrhynchos/director/direct_search.py", line 16, in generate_crossword
word, colrow = await cruciverbalist.choose_and_fill(crossword)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/lib/python3.11/site-packages/platyrhynchos/cruciverbalist/base.py", line 62, in choose_and_fill
return await self.find_word(colrows)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/lib/python3.11/site-packages/platyrhynchos/cruciverbalist/base.py", line 54, in find_word
choice = random.choices(words, weights=list(range(len(words))), k=1)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/lib/python311.zip/random.py", line 509, in choices
raise ValueError('Total of weights must be greater than zero')
ValueError: Total of weights must be greater than zero
PythonError https://cdn.jsdelivr.net/pyodide/v0.23.1/full/pyodide.asm.js:9
new_error https://cdn.jsdelivr.net/pyodide/v0.23.1/full/pyodide.asm.js:9
_PyCFunctionWithKeywords_TrampolineCall https://cdn.jsdelivr.net/pyodide/v0.23.1/full/pyodide.asm.js:9
pyodide.asm.js:9:105278
a http://localhost:8080/main.js:971
<anonymous> webpack-internal:///./src/index.js:27
AsyncFunctionThrow self-hosted:760
(Async: setTimeout handler)
hiwire_call_bound https://cdn.jsdelivr.net/pyodide/v0.23.1/full/pyodide.asm.js:9
Additional context
It might be due to lack of words
Describe the bug While generating crosswords in Pyodide, an exception rises sometimes:
Additional context It might be due to lack of words