Issue
Balancing a reaction using non-integer stoichiometry results in a KeyError: '.'
Example:
chempy.balance_stoichiometry(['NbO2F','FeF3'], ['Nb1.5Fe0.5O3F3'])
results in:
c:\users\jcumby\local documents\custom_python_libs\chempy\chempy\chempy\util\parsing.py in <genexpr>(.0)
648 infixes = _unicode_infix_mapping
649 return _formula_to_format(
--> 650 lambda x: "".join(_unicode_sub[str(_)] for _ in x),
651 lambda x: "".join(_unicode_sup[str(_)] for _ in x),
652 formula,
KeyError: '.'
Cause
The dict _unicode_sub defined in parsing.py has unicode subscript definitions for all numbers, but not for a dot, leading to the KeyError.
Solution
Unicode does not (I think?) have a subscript dot, so I can't find an obvious solution. Currently I have added a simple '.' to the _unicode_sub dict to solve the KeyError, but this does not give a correct Unicode representation. Hopefully someone more familiar with unicode has a better suggestion!
Issue
Balancing a reaction using non-integer stoichiometry results in a
KeyError: '.'Example:
results in:
Cause
The dict
_unicode_subdefined inparsing.pyhas unicode subscript definitions for all numbers, but not for a dot, leading to theKeyError.Solution
Unicode does not (I think?) have a subscript dot, so I can't find an obvious solution. Currently I have added a simple '.' to the
_unicode_subdict to solve the KeyError, but this does not give a correct Unicode representation. Hopefully someone more familiar with unicode has a better suggestion!