Interactive Html Bom Plugin for KiCad

Yes it works with nightlies. Your version of kicad doesnt seem to have python scripting enabled. Where did you get it from?

Edit: actually no, recent nightlies dont add python flag in version info anymore because it’s on by default. you must have extracted it with an extra folder or extracted it partially.

You are pasting the file structure into

C:\Users\myname\Documents\KiCad\5.99\scripting\plugins

but you have a Directory search response showing as

C:/Users/myname/Documents/KiCad/5.99/scripting\plugins

The slashes are (mostly) backward in the latter. Is that a typo created in the process of detailing this problem in the forum, or are those last two directories really using the wrong slashes?

Good catch, rco3. I will check tomorrow, as my computer is at my desk at work. I have tried so many different things, so I’ve lost track of it all. That’s why I tried to clean all traces of Kicad and do a fresh install. But I know to have at some point made the directories manually. I can’t rule out to have f’d up the slashes. But only for the last part of the paths, \scripting\plugins
C:/Users and
C:\Users is certainly not done by me manually.

Could there be some “lost in translation” going on here? Windows tends to translate some words to the local language. Maybe it changes the direction of the slash too?

Thanks for your kind help so far. I’ve used this plugin a lot earlier, mostly on the nightlies. It’s very helpful for prototyping etc.

Ignore the slashes, on windows both forward slash and backslash are interchangeable.
C:\Users\myname\Documents\KiCad\5.99\scripting\plugins
This path is correct and that’s where you should put the plugin. Make sure that when you extract it you extract everything but without additional intermediate folders. I.e. immediately in plugins folder there should be InteractiveHtmlBom subdirectory and within that the files and folders of plugin, including __init__.py file.
If you did all that but still don’t see the plugin then run this in scripting console:

import pcbnew
print(pcbnew.NOT_LOADED_WIZARDS)
print('---')
print(pcbnew.FULL_BACK_TRACE)

Copy and execute lines one at a time.

Thanks, qu1ck!

That last line, print(pcbnew.FULL_BACK_TRACE), got me on track to find the error. It throws an error message and then stops:

" File “C:\Program Files\KiCad\5.99\bin\lib\locale.py”, line 610, in setlocale
return _setlocale(category, locale)
locale.Error: unsupported locale setting"

I then checked Preferences -> Set language. I had it on “Default”
Changed it to English, restarted Kicad, and voila! The icon is now there, and everything works as intended.
Thanks for your help! :smiley:

1 Like

I’ve followed the instructions in the wiki for this,

  • download the zip file,
  • copied the “InteractiveHtmlBom” directory from within to C:\Users\Paula\AppData\Roaming\kicad\scripting\plugins
  • opened kicad,
  • opened PCBNew,
  • clicked “refresh plugins”
    and nothing appears.

I added the debugging info you asked of the previous person (I also tried setting it to english rather than default) and got this;

import pcbnew
print(pcbnew.NOT_LOADED_WIZARDS)
Skip subdir C:\Users\Paula\AppData\Roaming\kicad\scripting\plugins
C:\Users\Paula\AppData\Roaming\kicad\scripting\plugins\InteractiveHtmlBom
print('---')
---
print(pcbnew.FULL_BACK_TRACE)
Traceback (most recent call last):
  File "C:\Program Files\KiCad\lib\python2.7\site-packages/pcbnew.py", line 2954, in LoadPluginModule
    mod = __import__( ModuleName, locals(), globals() )
  File "C:\Users\Paula\AppData\Roaming\kicad\scripting\plugins/InteractiveHtmlBom/__init__.py", line 47, in <module>
    from .ecad.kicad import InteractiveHtmlBomPlugin
ImportError: No module named kicad

This is a clean, fresh install of KiCAD 5.1.10 on windows 10 (also brand new machine, so new install)

Are there some dependencies or things I’ve missed?

Many thanks in advance
Paula

Looks like you’re mixing Forward and Backward slashes in the paths to files…

How do I change it? this is all from default setup.

First thing to do is understand how to setup and implement/Use the BOM plugin. When you get to the part about the path, you type info into the field…

example below

@BlackCoffee this is not an eeschema bom plugin, please read about it before offering wrong advice.

@PaulaM ignore the slashes, forward and back slash are interchangeable as path separators on Windows.
The issue is this:

File "C:\Users\Paula\AppData\Roaming\kicad\scripting\plugins/InteractiveHtmlBom/__init__.py", line 47, in <module>
    from .ecad.kicad import InteractiveHtmlBomPlugin
ImportError: No module named kicad

It seems you are missing InteractiveHtmlBom/ecad/kicad.py file. Can you check if it’s there? Did you extract the folder with all subfolders and files?

I read your initial post - you say Nothing about eeschema, pcbnew or have info to suggest your intened use.
And, there are zillion posts - who would read them all!!!
I won’t try your plugin but, on my system (OSX) I cannot mix slashes without Python problems…

Yes, that file is there.
And yes I extracted the file and all it’s contents, then copied the InteractiveHtmlBom folder, and it’s contents to the directory.

I do say that instructions are on Github with a link to github. Granted, I could add a direct link to wiki page with instructions. I’ll do that.

There is no issue with mixed slashes on OSX or linux, my plugin is tested and supported on all platforms.

This is weird. Did you restart kicad after that? If not please restart and then do the diagnostics from scripting console again

import pcbnew
print(pcbnew.FULL_BACK_TRACE)

Yes have done lots of KiCAD restarts :slight_smile:

here’s what it says now (different to before)

import pcbnew
print(pcbnew.FULL_BACK_TRACE)
Traceback (most recent call last):
  File "C:\Program Files\KiCad\lib\python2.7\site-packages/pcbnew.py", line 2954, in LoadPluginModule
    mod = __import__( ModuleName, locals(), globals() )
  File "C:\Users\Paula Maddox\AppData\Roaming\kicad\scripting\plugins/InteractiveHtmlBom/__init__.py", line 47, in <module>
    from .ecad.kicad import InteractiveHtmlBomPlugin
  File "C:\Users\Paula Maddox\AppData\Roaming\kicad\scripting\plugins/InteractiveHtmlBom/ecad/kicad.py", line 9, in <module>
    from ..core import ibom
  File "C:\Users\Paula Maddox\AppData\Roaming\kicad\scripting\plugins/InteractiveHtmlBom/core/ibom.py", line 10, in <module>
    from typing import Optional
ImportError: No module named typing

This makes more sense. I pushed a fix to github. You can either get fresh version (make sure to completely delete old one, extract new, restart kicad) or you can run this in cmd:

<path/to/kicad>/bin/pip.exe install typing

and restart kicad, which will also fix the issue.

1 Like

WOHOOO!!!
thank you so much, it’s up and running!
(i’m showing my boss KiCAD to get him to switch away from fusion360 and your HTML plugin is one of the best features for KiCAD).

4 Likes

It is!
There is only 1 major drawback though…
Qu1ck won’t take donations for it. Instead I donated to CERN directly.
Thanks again! :+1:

2 Likes

FYI-Clarification - The reason you can now mix the slashes (screenshot below). For older codes ver’s<3.4, can’t mix them without problems (should say, “I can’t mix them on my machine”). And, yes, I still use some older Python codes for Kicad Plugin’s. Specifically, codes to run external Java codes with declared paths to the files… But, I get your point…

That is completely unrelated.

Support of slashes has nothing to do with python itself, it’s about os filesystem. Windows treats both ‘/’ and ‘\’ as path separators (at least since win NT). *nix based systems require ‘/’.

My plugin code doesn’t care about slashes and uses os.path functions and relative imports for compatibility across all platforms and py2 and py3. The reason you see mix of slashes in stack trace is because of nuances of how kicad imports modules but it’s harmless.

Good idea, I’ll do the same.