Skip to content

Fix import path for StandardBox

KiCad Bot requested to merge github/fork/SeanDS/fix/battery-script into master

Created by: SeanDS

I tried to run BatteryHolder.py and got the error:

Traceback (most recent call last):
  File "BatteryHolder.py", line 11, in <module>
    from tree.master.scripts.general.StandardBox import *
ModuleNotFoundError: No module named 'tree'

I think import paths must have changed elsewhere in the library because tree doesn't exist in the project nor as a dependency (as far as I can tell). I looked for other examples where a "general" script is used from another script to see how this is handled there, but I couldn't find any others so I fixed this by appending the "general" scripts directory to the Python path like you do with the KicadModTree path.

This fixes the issue for me on Python 3 (not tested Python 2), but I guess given that in #154 (closed) you packaged KicadModTree on PyPI and added a setup.py file, this path hacking should be removed entirely at some point.

Edited by Joel Guittet

Merge request reports