hildogjr / KiCost

Build cost spreadsheet for a KiCad project.
MIT License
524 stars 97 forks source link

list index out of range - when using dist# and kicost:dist:pricing #368

Closed mdeweerd closed 5 years ago

mdeweerd commented 5 years ago

KiCost version 1.1.1 (installed using pip)

I get error File "/usr/lib/python3.7/site-packages/kicost/distributors/api_partinfo_kitspace.py", line 300, in query_part_info part_code_dist = list({k for k, v in dist_xlate.items() if v == part_catalogue_code_dist})[0] IndexError: list index out of range

I found that this is because I have kicost:dist:pricing for one component and dist# for another component.

I enclose an example which fails and two variants of the example that pass. The executed commands are in "tests.sh", the log is in tests.log.

hildogjr commented 5 years ago

Are the used example into the test suit? I re-checked all the examples in the library... Please, provide me a simple example to reproduce this issue.

mdeweerd commented 5 years ago

Hi Hildago

I was convinced that I attached this example: testcase.zip

Hopefully it is ok for you.

hildogjr commented 5 years ago

It was due the "tme#". The new API Kitspace doesn't support it and it was trying to use. Now the code check if the code is supported before use.