KiBom generator


#1

Hi,
don’t know if this thread is in the right place here.

I al using for my Bom’s the KiBom plug in.
But in my latest project when i try to generate the bom i get following error code:

Run command:
python “E:/Program Files/KiCad/bom gen/KiBoM-master/KiBOM_CLI.py” “E:/Users/Peter/Documents/schemas/KiCad PCB/Tester_Kaboem_Main/Tester_Kaboem_Main.xml” “E:/Users/Peter/Documents/schemas/KiCad PCB/Tester_Kaboem_Main/Tester_Kaboem_Main”

Command error. Return code 1

Error messages:
Traceback (most recent call last):
File “E:/Program Files/KiCad/bom gen/KiBoM-master/KiBOM_CLI.py”, line 124, in
groups = net.groupComponents(components)
File “E:/Program Files/KiCad/bom gen/KiBoM-master/bomlib/netlist_reader.py”, line 425, in groupComponents
g.updateFields(self.prefs.useAlt, self.prefs.altWrap)
File “E:/Program Files/KiCad/bom gen/KiBoM-master/bomlib/component.py”, line 457, in updateFields
self.updateField(f, c.getField(f))
File “E:/Program Files/KiCad/bom gen/KiBoM-master/bomlib/component.py”, line 446, in updateField
fld = fieldData))
UnicodeEncodeError: ‘ascii’ codec can’t encode character u’\xb5’ in position 7: ordinal not in range(128)

Does someone know what to do or what it means?
Thanks In advance
Peter


#2

Without knowing anything about KiBom I can say this is the nightmare of every python programmer - a unicode issue. Somewhere in the program python expects ascii-only string and gets a string which has a character which doesn’t belong to 7-bit ascii. It’s a programmer’s mistake and a bug in the KiBom program. Maybe you could avoid it by changing all names etc. in your data (and pathnames etc.) to have only ascii characters. Which means no German, Chinese, Turkish, Finnish etc.


#3

Or KiBom expects to be run with python 3.x


It fails when it tries to print an error message regarding a field conflict: https://github.com/SchrodingersGat/KiBoM/blob/master/bomlib/component.py#L446

(Assuming you run the version currently in the master branch. Otherwise you need to look what is at line 446 in your own version)

The char it complains about is “µ”.


Hm it seems not even python3 supports printing unicode by default on all systems. In this case the kicad internal console might be to blame. See: https://stackoverflow.com/questions/10569438/how-to-print-unicode-character-in-python

Tested in fedora 26: both pyhton 2.7 and python 3.6 print unicode to the bash with default settings so i guess it is either an operating system problem or a kicad output console problem.


#4

Ok,
found the problem, Apparently i used the µ for capacitors, so instead of 1µF i put in 1uF and problem is fixed.

Thanks @eelik and @Rene_Poschl for putting me in the right direction.

Can be closed!


#5

I would post an issue @ KiBOM GH repo to help in fixing this :smiley:


#6

The unicode issues have kept popping up, if you have found another point of failure please raise an issue on my GitHub repo and I’ll endeavour to fix it ASAP :slight_smile: