devbisme / KiField

Edit/insert/delete part fields in KiCad schematics or libraries using a spreadsheet.
MIT License
70 stars 27 forks source link

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

Closed scandey closed 3 years ago

scandey commented 3 years ago

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):

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.

xesscorp commented 3 years ago

Thanks! This error forced my to update my pytests.