aspell-python
aspell-python copied to clipboard
`extra-dicts` arg doesn't work with multiple dicts
ConfigKeys
says extra-dicts
takes a list:
>>> import aspell
>>> aspell.ConfigKeys()['extra-dicts']
('list', [], 'extra dictionaries to use')
But passing it as a list doesn't work:
>>> aspell.Speller(('extra-dicts', ['./a.dict', './b.dict']))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: argument 0: tuple of two strings (key, value) expeced
(Also a typo: expeced
should be expected
)
Passing a single dict does work for a single dict:
>>> aspell.Speller(('extra-dicts', './a.dict'))
<AspellSpeller object at 0x100991d50>
But ignores the first option if passed multiple times:
# Confirm that ./bad.dict doesn't exist
>>> aspell.Speller(('extra-dicts', './bad.dict'))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
aspell.AspellSpellerError: The file "./bad.dict" can not be opened for reading.
# But it's not opened if it's replaced by a later arg
>>> aspell.Speller(('extra-dicts', './bad.dict'), ('extra-dicts', './b.dict'))
<AspellSpeller object at 0x1008d1f70>
add-extra-dicts
works:
>>> aspell.Speller(('add-extra-dicts', './a.dict'), ('add-extra-dicts', './b.dict'))
<AspellSpeller object at 0x1008d1f70>
# Check to make sure not silently skipping the first dict
>>> aspell.Speller(('add-extra-dicts', './bad.dict'), ('add-extra-dicts', './b.dict'))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
aspell.AspellSpellerError: The file "./bad.dict" can not be opened for reading.
>>> aspell.Speller(('add-extra-dicts', './bad.dict'), ('add-extra-dicts', './b.dict'))
But it's confusing since add-extra-dicts
doesn't show up in ConfigKeys
:
>>> aspell.ConfigKeys()['add-extra-dicts']
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
KeyError: 'add-extra-dicts'
Thank you for the detailed report.