devbisme / KiField

Edit/insert/delete part fields in KiCad schematics or libraries using a spreadsheet.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[KiField Bug] NameError: name 'reduce' is not defined

scandey opened this issue · comments

Describe the bug
On an attempted extraction with groups from Kicad 5.1.10 schematic, Kifield crashes with a missing method "reduce". This issue is new since Kifield 0.1.17.

To Reproduce
Steps to reproduce the behavior:

  1. kifield -x someschem.sch -i output.csv -g
  2. See error

Traceback (most recent call last):
File "/usr/local/bin/kifield", line 8, in
sys.exit(main())
File "/usr/local/lib/python3.9/site-packages/kifield/main.py", line 141, in main
kifield(
File "/usr/local/lib/python3.9/site-packages/kifield/kifield.py", line 1505, in kifield
insert_part_fields(
File "/usr/local/lib/python3.9/site-packages/kifield/kifield.py", line 1470, in insert_part_fields
insertion_function(
File "/usr/local/lib/python3.9/site-packages/kifield/kifield.py", line 857, in insert_part_fields_into_xlsx
wb = group_wb(wb)
File "/usr/local/lib/python3.9/site-packages/kifield/kifield.py", line 103, in group_wb
grouped_rows.append((collapse(ref),) + unique_rows[i])
File "/usr/local/lib/python3.9/site-packages/kifield/common.py", line 242, in collapse
groups = reduce(make_groups, parts, [])
NameError: name 'reduce' is not defined

Expected behavior
Schematic should be extracted.

Desktop (please complete the following information):

  • OS: Mac OS 11.3
  • Python version: Python 3.9.5
  • KiField version: 0.1.18
  • KiCad version: 5.1.10

Additional context
A brief glance through common.py would suggest that it is missing an import, "from functools import reduce" that appeared in kifield.py from 0.1.17.

Thanks! This error forced my to update my pytests.