You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The code tries to cast the value to both a float and an int, and then checks if they are equal. However if the value is actually a float, then casting to an int will throw a ValueError.
I changed the function to the following and it works now:
def value1(self, d, type):
""" VALUE """
v = float(d[0])
try:
iv = int(d[0])
if iv == v:
v = iv
except ValueError:
pass
self.parsed[type] = v
return v
I suspect that there is a better way to determine the correct value of v, but this fix was sufficient to get things working.
The text was updated successfully, but these errors were encountered:
Hi @tlalexander and @krasin !
Thanks for looking at the code! @tlalexander solution is really pythonic, but @krasin solution is simpler.
I'm applying the second, which passes the tests, including a new one for 0.1%
I specified some 0.1% resistors and this caused output to fail due to a ValueError thrown from this line:
https://github.com/INTI-CMNB/KiBot/blob/eb6c2140f218f88222cfc5878f322c3a00e8115a/kibot/bom/electro_grammar.py#LL72C6-L72C6
The code tries to cast the value to both a float and an int, and then checks if they are equal. However if the value is actually a float, then casting to an int will throw a ValueError.
I changed the function to the following and it works now:
I suspect that there is a better way to determine the correct value of v, but this fix was sufficient to get things working.
The text was updated successfully, but these errors were encountered: