BOM export python error code 3

Recently updated to KiCad (5.1.5-rc1-1-g88a03f1a1)-1, release build

Used to use BOM wizard plugin which did a good job, and was working in the last official release. However right now I’m getting an error:

Command error. Return code 3
Error messages:
Could not find platform independent libraries
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to [:<exec_prefix>]
Fatal Python error: initfsencoding: unable to load the file system codec
ModuleNotFoundError: No module named ‘encodings’

Not wanting to bother the developer of the plugin just yet, as it feels very much a Python/KiCad problem. I’m really not that into Python, so I hope anybody can direct me in the right direction to get a hunch of what’s going wrong here.

Application: Eeschema
Version: (5.1.5-rc1-1-g88a03f1a1)-1, release build
Libraries:
wxWidgets 3.0.4
libcurl/7.66.0 OpenSSL/1.1.1d (Schannel) zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.1.1) nghttp2/1.39.2
Platform: Windows 8 (build 9200), 64-bit edition, 64 bit, Little endian, wxMSW
Build Info:
wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8)
Boost: 1.71.0
OpenCASCADE Community Edition: 6.9.1
Curl: 7.66.0
Compiler: GCC 9.2.0 with C++ ABI 1013

Build settings:
USE_WX_GRAPHICS_CONTEXT=OFF
USE_WX_OVERLAY=OFF
KICAD_SCRIPTING=ON
KICAD_SCRIPTING_MODULES=ON
KICAD_SCRIPTING_PYTHON3=OFF
KICAD_SCRIPTING_WXPYTHON=ON
KICAD_SCRIPTING_WXPYTHON_PHOENIX=OFF
KICAD_SCRIPTING_ACTION_MENU=ON
BUILD_GITHUB_PLUGIN=ON
KICAD_USE_OCE=ON
KICAD_USE_OCC=OFF
KICAD_SPICE=ON

I ran into this when I somehow garbled up my kicad python env with pip and manually copying over some libs.
Do a clean install (completely delete kicad folder and reinstall) and you should be fine.

Tried this, also tried adding the BOM python files, but it doesn’t work.

I might have given some wrong information in the openingspost though. Instead of the BOM wizard I’m using the supplied python script with KiCad, and specifically the “bom_html_with_advanced_grouping” which generates this error.
Although I don’t expect that might make any difference to the error I’m experiencing.

And what did you put in command line?

That which is already there (and worked before):
python “C:\Program Files\KiCad\bin\scripting\plugins/bom_html_with_advanced_grouping.py” “%I” “%O”

That will call whatever default python is there in the system, not necessarily KiCad’s python. So you reinstalling kicad would not effect that broken python.
Try this in command line:
"C:\Program Files\KiCad\bin\python.exe" “C:\Program Files\KiCad\bin\scripting\plugins/bom_html_with_advanced_grouping.py” “%I” “%O”

Nope, still nothing. Tried reinstall of python, but that too didn’t work.

Guess I should try to delete any python temporary files and try it again, would that work? Any hints on what directories not to forget?

If you just put this in cmd does it run?
"C:\Program Files\KiCad\bin\python.exe"

If not then you have not reinstalled kicad cleanly. If it does then you still have some other python broken on your system and you are not invoking kicad’s python properly.
Also take a look at environment variables, remove anything python related like PYTHONHOME and PYTHONPATH.

This was now also reported on the bugtracker https://bugs.launchpad.net/kicad/+bug/1853496

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