-
Notifications
You must be signed in to change notification settings - Fork 5
Error when trying to convert fluid ounces into one cup #3
Description
Hi
I am getting an error when trying to convert fluid ounces in one cup.
"How many fluid onces are in one cup?"
Both are form the same dimension so it should be possible.
I think the error handling should be improved to explain what the exact error is.
This is what I get out of the skills.log:
2020-02-15 12:45:29.180 | ERROR | 769 | mycroft.skills.mycroft_skill.mycroft_skill:on_error:805 | An error occurred while processing a request in Unit Conversion Skill
Traceback (most recent call last):
File "/opt/mycroft/skills/mycroft-skill-unitconversion.traverseda/init.py", line 20, in handle_unit_conversion
result = round((count*ureg(source)).to(target),2)
File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/pint/registry.py", line 1122, in parse_expression
lambda x: self._eval_token(
File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/pint/pint_eval.py", line 92, in evaluate
left = self.left.evaluate(define_op, bin_op, un_op)
File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/pint/pint_eval.py", line 102, in evaluate
return define_op(self.left)
File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/pint/registry.py", line 1123, in
x, case_sensitive=case_sensitive, use_decimal=use_decimal, **values
File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/pint/registry.py", line 1081, in _eval_token
{self.get_name(token_text, case_sensitive=case_sensitive): 1}
File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/pint/registry.py", line 612, in get_name
raise UndefinedUnitError(name_or_alias)
pint.errors.UndefinedUnitError: 'one' is not defined in the unit registry
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/pi/mycroft-core/mycroft/skills/mycroft_skill/event_container.py", line 66, in wrapper
handler(message)
File "/opt/mycroft/skills/mycroft-skill-unitconversion.traverseda/init.py", line 31, in handle_unit_conversion
self.speak_dialog("unknownUnitError",{"units":e.unit_names})
AttributeError: 'UndefinedUnitError' object has no attribute 'unit_names'
2020-02-15 12:46:57.058 | ERROR | 769 | mycroft.skills.mycroft_skill.mycroft_skill:on_error:805 | An error occurred while processing a request in Unit Conversion Skill
Traceback (most recent call last):
File "/opt/mycroft/skills/mycroft-skill-unitconversion.traverseda/init.py", line 20, in handle_unit_conversion
result = round((count*ureg(source)).to(target),2)
File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/pint/quantity.py", line 561, in to
other = to_units_container(other, self._REGISTRY)
File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/pint/util.py", line 832, in to_units_container
return registry._parse_units(unit_like)
File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/pint/registry.py", line 1167, in _parse_units
return super()._parse_units(input_string, as_delta)
File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/pint/registry.py", line 1052, in _parse_units
cname = self.get_name(name)
File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/pint/registry.py", line 612, in get_name
raise UndefinedUnitError(name_or_alias)