BOM generation in 5.99 on MacOS

There have been some other posts on this, and I’m pretty sure it’s a path problem.
I tried some of the other solutions with no success.

I located the files in question and the path to python - but the errors I’m getting are impenetrable

I’m on MacOS

This is the command line
/usr/bin/python “/Applications/KiCad/KiCad.app/Contents/SharedSupport/plugins/bom_csv_grouped_by_value.py” “%I” “%O.csv”

/usr/bin/python “/Applications/KiCad/KiCad.app/Contents/SharedSupport/plugins/bom_csv_grouped_by_value.py” “/Users/paulbadger/Documents/ [ file path ]/foo.xml” “/Users/paulbadger/Documents/ [ file path ]/foo.csv”
Command error. Return code 1.
ImportError: No module named site

“No module named site” ?

Any ideas?

I had this issue couple of times. There are several things that helped me.

  1. Try using python3 inside the KiCad package and be sure that it’s python3 and not something else.
  2. If 1. didn’t work – restart KiCAD and re-open the project.
  3. Restart your mac. Honestly have no idea how, but it helped 2 times already.

I have no idea what the core issue is, but as it’s nightly - just happy to get a workaround fast.

Thanks for some breadcrumbs
Seems like python3.8 is inside kicad

I tried an absolute path there and things worked worse.

Maybe I’ll try zapping the system python before booting kicad
Oh well - I’ll get it eventually.

I just managed to replicate your problem in the latest build.
Here’s how O’ve fixed it on my system:
python3 “[path_to_kicad]/KiCad.app/Contents/SharedSupport/plugins/bom_csv_grouped_by_value.py” “%I” “%O.csv”

I’m not sure if script is using system python3 or embedded one. Without specifying python3 get similar error.

No joy here

python3 “/Applications/Kicad/KiCad.app/Contents/SharedSupport/plugins/bom_csv_grouped_by_value.py” “/Users/paulbadger/Documents/ Consulting[path]/DirectionalTest0.xml” “/Users/paulbadger/Documents/ Consulting/[path]/DirectionalTest0.3.csv”
Command error. Return code -1.
execvp(python3, “/Applications/Kicad/KiCad.app/Contents/SharedSupport/plugins/bom_csv_grouped_by_value.py”, “/Users/paulbadger/Documents/, Consulting/[path]/DirectionalTest0.xml”, “/Users/paulbadger/Documents/, Consulting/[path]/DirectionalTest0.3.csv”) failed with error 2!

Note that in the first error there is a space introduced into the path before “Consulting”
In the second error there is a comma and a space introduced at the same place.

Bad parsing of Mac paths?

Try moving the project to a path without any spaces or other odd characters in it (try copying it to the desktop, for instance) and run the BOM generation from there. I try and avoid any spaces in paths these days as I’ve run into numerous problems with scripts over the years.

I tried a simpler path but got similar errors. I will repeat that experiment.

Kicad 5.1 generated BOMs from the same place with no fuss.

Also please note that the errors show spaces where there are none in actual paths.

Ah - OK - I thought you might have had ~/Documents, Consulting/ as a real path. I had a recent problem with the generator in 5.99 too - no probs with 5.1 but unable to generate a BOM. XML looked good. Problem seemed to be related to a symbol I had edited and went away when I changed back to the original symbol. I have not been able to repeat it.

OK this is making sense then. I am seeing a populated XML file so that part worked at least with one of my attempts. I may have some edited symbols. I guess I should try this thing on a simpler file and see what that yields. This has been a time consuming an frustrating endeavor.

This worked for me using Macos 11.5.1
Changed python to python3.
Example:
python3 “/Applications/KiCad/KiCad.app/Contents/SharedSupport/plugins/bom_csv_grouped_by_value.py” “%I” “%O.csv”

Using:
Application: KiCad Schematic Editor

Version: (5.99.0-11489-g75190370dd), release build

Libraries:
wxWidgets 3.1.5
libcurl/7.64.1 SecureTransport (LibreSSL/2.8.3) zlib/1.2.11 nghttp2/1.41.0

Platform: macOS Version 10.16 (Build 20G80), 64 bit, Little endian, wxMac

Build Info:
Date: Jul 20 2021 01:52:12
wxWidgets: 3.1.5 (wchar_t,STL containers)
Boost: 1.76.0
OCC: 7.5.1
Curl: 7.54.0
ngspice: 31
Compiler: Clang 10.0.1 with C++ ABI 1002

Build settings:
KICAD_USE_OCC=ON
KICAD_SPICE=ON

Thanks for the report mibac
I would have to assume it’s something in my system or Python installs. My OS is two behind yours - shouldn’t be much of big deal as python is doing all the work.

Just a puzzle so far with impenetrable errors. I would reload v 5.1 to get my job out if I thought I could get the files to go back there - but from what I read, file format has been updated.

Maybe I’ll see if I can pick through the XML file by hand

A bit more information.
$ is a Terminal prompt

$ which python3
/usr/local/bin/python3

$ ll /usr/local/bin/python3
lrwxr-xr-x … /usr/local/bin/python3 -> …/Cellar/python@3.9/3.9.6/bin/python3

I think it’s finding python. I can’t interpret the meager exit codes.
I thought it was making the XML successfully but that seems like it may have only happened once. I’ve set all the permissions wide open, changed the owner of the files and tried a variety of absolute paths. I’ve chewed up more time than I would like on this issue and I’ve got a board that I need to order parts for. I’m going to bite the bullet soon and do it by hand but that won’t help the next person.

I am not sure how recent your 5.99 installation is but there has been quite a bit of work on Python3 in KiCad recently, so you might find a more recent build has fixed it. I can build BOMs on my macOS build from Version: (5.99.0-11626-g43523df843) which I downloaded a few days ago.

You could try including the full path to the KiCad provided python - this should pull in the site-packages.

/Applications/KiCad/KiCad.app/Contents/Frameworks/Python.framework/Versions/3.8/bin/python3 “/Applications/KiCad/KiCad.app/Contents/SharedSupport/plugins/bom_csv_grouped_by_value.py” “%I” “%O.csv”

Otherwise, a couple of workarounds. You could try an alternative BOM exporter. There are a couple of external ones - KiBOM is one that I use most of the time.

You can directly copy and paste from the symbol field table into a spreadsheet.
Screenshot 2021-08-10 at 10.34.55

And, you could export from the pcb layout, using the excellent InteractiveHtmlBom plugin,

Oh, and Iv’e just found out that you can also (from pcbnew) do a ‘File’ -> ‘Fabrication Outputs’ -> ‘BOM…’

thanks for the tips, I did have the idea and downloaded the latest nightly when I had the problem
Thanks for the lead on the plugin? KiBom

My previous post listed info for creating a BOM file on a macbookpro with Mac OS 11.4
Today I was using a MacPro with Mac OS 10.14.6. The following command worked for me in the BOM dialog box. Using Kicad 5.99 nightly Version: (5.99.0-11444-g3c721c55de), release build.

/Applications/KiCad/KiCad.app/Contents/Frameworks/Python.framework/Versions/3.8/bin/python3.8 “/Applications/KiCad/KiCad.app/Contents/SharedSupport/plugins/bom_csv_grouped_by_value.py” “%I” “%O.csv”

thanks - I checked the path to the python script which seemed correct on my setup. There is some mystery in my Kicad setup I believe. I just downloaded the latest nighty version. So if the XML is being created how can the CSV file be not found?

Some permissions issue? - I have the whole directory as set wide open at 777

XML is being created - problems are in creating the CSV

/Applications/KiCad/KiCad.app/Contents/Frameworks/Python.framework/Versions/3.8/bin/python3.8 “/Applications/KiCad/KiCad.app/Contents/SharedSupport/plugins/bom_csv_grouped_by_value.py” “/Users/paulbadger/Documents/testProj/testProject/testProject.xml” “/Users/paulbadger/Documents/testProj/testProject/testProject.csv”
Command error. Return code 2.
/Applications/KiCad/KiCad.app/Contents/Frameworks/Python.framework/Versions/3.8/bin/python3.8: can’t open file ‘“/Applications/KiCad/KiCad.app/Contents/SharedSupport/plugins/bom_csv_grouped_by_value.py”’: [Errno 2] No such file or directory

Here’s the details for what they’re worth

Application: KiCad Schematic Editor

Version: (5.99.0-11678-ga208dac8d8), release build

Libraries:
wxWidgets 3.1.5
libcurl/7.54.0 LibreSSL/2.6.5 zlib/1.2.11 nghttp2/1.24.1

Platform: macOS Mojave Version 10.14.6 (Build 18G87), 64 bit, Little endian, wxMac

Build Info:
Date: Aug 10 2021 01:54:08
wxWidgets: 3.1.5 (wchar_t,STL containers)
Boost: 1.76.0
OCC: 7.5.1
Curl: 7.54.0
ngspice: 31
Compiler: Clang 10.0.1 with C++ ABI 1002

Build settings:
KICAD_USE_OCC=ON
KICAD_SPICE=ON

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.