Traceback (most recent call last):
File "C:\GH\jlcparts\jlcparts\datatables.py", line 232, in extractComponent
attr = dict([normalizeAttribute(key, val) for key, val in attr.items()])
File "C:\GH\jlcparts\jlcparts\datatables.py", line 232, in <listcomp>
attr = dict([normalizeAttribute(key, val) for key, val in attr.items()])
File "C:\GH\jlcparts\jlcparts\datatables.py", line 93, in normalizeAttribute
value = attributes.inductanceAttribute(value)
File "C:\GH\jlcparts\jlcparts\attributes.py", line 291, in inductanceAttribute
value = readInductance(value)
File "C:\GH\jlcparts\jlcparts\attributes.py", line 129, in readInductance
return readWithSiPrefix(value)
File "C:\GH\jlcparts\jlcparts\attributes.py", line 51, in readWithSiPrefix
return float(value[:-1]) * unitPrexies[value[-1]]
ValueError: could not convert string to float: '11.5u;12.5'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "\\?\C:\GH\jlcparts\venv\Scripts\jlcparts-script.py", line 33, in <module>
sys.exit(load_entry_point('jlcparts', 'console_scripts', 'jlcparts')())
File "C:\GH\jlcparts\venv\lib\site-packages\click\core.py", line 1157, in __call__
return self.main(*args, **kwargs)
File "C:\GH\jlcparts\venv\lib\site-packages\click\core.py", line 1078, in main
rv = self.invoke(ctx)
File "C:\GH\jlcparts\venv\lib\site-packages\click\core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\GH\jlcparts\venv\lib\site-packages\click\core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\GH\jlcparts\venv\lib\site-packages\click\core.py", line 783, in invoke
return __callback(*args, **kwargs)
File "C:\GH\jlcparts\jlcparts\datatables.py", line 308, in buildtables
dataTable = buildDatatable(components)
File "C:\GH\jlcparts\jlcparts\datatables.py", line 256, in buildDatatable
"components": [extractComponent(x, schema) for x in components]
File "C:\GH\jlcparts\jlcparts\datatables.py", line 256, in <listcomp>
"components": [extractComponent(x, schema) for x in components]
File "C:\GH\jlcparts\jlcparts\datatables.py", line 249, in extractComponent
raise RuntimeError(f"Cannot extract {component['lcsc']}").with_traceback(e.__traceback__)
File "C:\GH\jlcparts\jlcparts\datatables.py", line 232, in extractComponent
attr = dict([normalizeAttribute(key, val) for key, val in attr.items()])
File "C:\GH\jlcparts\jlcparts\datatables.py", line 232, in <listcomp>
attr = dict([normalizeAttribute(key, val) for key, val in attr.items()])
File "C:\GH\jlcparts\jlcparts\datatables.py", line 93, in normalizeAttribute
value = attributes.inductanceAttribute(value)
File "C:\GH\jlcparts\jlcparts\attributes.py", line 291, in inductanceAttribute
value = readInductance(value)
File "C:\GH\jlcparts\jlcparts\attributes.py", line 129, in readInductance
return readWithSiPrefix(value)
File "C:\GH\jlcparts\jlcparts\attributes.py", line 51, in readWithSiPrefix
return float(value[:-1]) * unitPrexies[value[-1]]
RuntimeError: Cannot extract C3606553
The issue seems to be the semicolon dual inductance value.
I have fixed this by adding a exception test to return -1 if this happens again (I assumed you'd want a proper fix so didn't do a pull request for something so small and such a janky fix but can if you'd prefer that):
attributes.py
line 50:
if value[-1].isalpha() or value[-1] == "?": # Again, watch for the ? typo try: return float(value[:-1]) * unitPrexies[value[-1]] except: print(f"Failed to parse {value}") return float(-1) return float(value)
Thanks for the great tool!
I have added a quick and easy workaround so this is not stopping my playing around but I thought you might want to know.
I'm starting to build the tables using the suggested command:
jlcparts buildtables cache.sqlite3 web/public/data
It fails at 2.4% with this error:
The issue seems to be the semicolon dual inductance value.
https://www.lcsc.com/product-detail/Wireless-Charging-Coils_Signal-Transformer-WTM12R5K-A28_C3606553.html
Inductance: 11.5uH;12.5uH
I have fixed this by adding a exception test to return -1 if this happens again (I assumed you'd want a proper fix so didn't do a pull request for something so small and such a janky fix but can if you'd prefer that):
attributes.py
line 50:
if value[-1].isalpha() or value[-1] == "?": # Again, watch for the ? typo try: return float(value[:-1]) * unitPrexies[value[-1]] except: print(f"Failed to parse {value}") return float(-1) return float(value)
Thanks again it's great!
stay slaying aaron