Bom generation error in 5.99

When i had launched BOM generation, it give me the error message

python "C:\Program Files\KiCad\5.99\bin\scripting\plugins/bom_csv_grouped_by_value_with_fp.py" "D:\V_meter_2\stend_e3\stend_main4_dummy\stend_main.xml" "D:/V_meter_2/stend_e3/stend_main4_dummy/stend_main.csv" Command error. Return code 1. Traceback (most recent call last): File "C:\Program Files\KiCad\5.99\bin\scripting\plugins\bom_csv_grouped_by_value_with_fp.py", line 74, in <module> out.writerow([refs, len(group), File "C:\Program Files\KiCad\5.99\bin\lib\encodings\cp1252.py", line 19, in encode return codecs.charmap_encode(input,self.errors,encoding_table)[0] UnicodeEncodeError: 'charmap' codec can't encode characters in position 115-125: character maps to <undefined>

how can i fix my schematic or symbol properties to generation script will be able to generate BOM properly?

Try setting one of these environment variables:
PYTHONIOENCODING=UTF-8
PYTHONUTF8=1

Problem is your windows regional settings lead to python using cp1252 instead of utf8. This should be fixed in bom script itself but the environment variable can be an interim workaround.

1 Like

mmmm I’m tempted to fix this by just modifying python’s manifest they cant be bothered to default to utf-8

1 Like


does it right place?

Yes, make sure to relogin into your user or restart the OS for changes to take effect.

1 Like

i check it before restart OS, it wasn’t took effect. SO, will reboot now.

after reboot i had the message like this

Its the same error, try PYTHONUTF8=1

1 Like

but after reboot the changed variable didn’t saved in system. so, it was useless to check it after rebooting?

If it didnt save, then yes, it was useless. But not sure why it wouldn’t, unless you are in some corporate IT environment with strict policies that reset it on every reboot.
But either way, PYTHONUTF8=1 has more chances to work as it’s intended for all IO while PYTHONIOENCODING is intended for stdin/out/err only (at least according to docs).

1 Like

6
this is my workflow. and this system is on my personal PC.

Looks right, you just have to click Ok/Save on all windows that you opened to get there and reboot.

1 Like

7
i didn’t reboot yet

There you go, now we know variable works, you just have to make sure it is saved after reboot.

1 Like

i had get .csv file, but where is generating BOM settings? There too much values printed, but i need only few of them. How to set in BOM generator to print values choosed only? or create BOM formatting? i didn’t find in preferences something.

Kicad built in bom generators are pretty limited and primitive. You can edit python code to make it do what you want or use other community tools, there are few good choices linked in faq at the end.

1 Like