Skip to content

[SKiDL BUG] Issue with SKiDL generate_schematic on KiCad 5Β #237

@Hachicun

Description

@Hachicun

Describe the bug
Hi SKiDL team,

I have successfully tested the latest version of SKiDL with KiCad 8, and it works well. However, I would like to use the generate_schematic feature with KiCad 5. To achieve this, I uninstalled everything and installed KiCad 5.

I have also set the environment variable KICAD_SYMBOL_DIR to C:\Program Files\KiCad\share\kicad\library (I have verified that this is the correct directory). However, when I run the script, I encounter the following error (see the attached screenshot).

Could you please suggest a solution for this issue? I would appreciate any guidance on how to resolve this.

**Desktop

  • OS windows 11
  • Python version: 3.12
  • SKiDL version [e.g. 22]:2.0

My error:

 " WARNING: KICAD6_SYMBOL_DIR environment variable is missing, so the default KiCad symbol libraries won't be searched. @ [D:\Dev\SKiDL\<frozen importlib._bootstrap_external>:995=>D:\Dev\SKiDL\<frozen importlib._bootstrap>:488]
WARNING: KICAD7_SYMBOL_DIR environment variable is missing, so the default KiCad symbol libraries won't be searched. @ [D:\Dev\SKiDL\<frozen importlib._bootstrap_external>:995=>D:\Dev\SKiDL\<frozen importlib._bootstrap>:488]
WARNING: KICAD8_SYMBOL_DIR environment variable is missing, so the default KiCad symbol libraries won't be searched. @ [D:\Dev\SKiDL\<frozen importlib._bootstrap_external>:995=>D:\Dev\SKiDL\<frozen importlib._bootstrap>:488]
ERROR: Can't open file: Device.
 @ [d:\Dev\SKiDL\divider.py:4]
WARNING: Could not load KiCad schematic library "Device", falling back to backup library. @ [d:\Dev\SKiDL\divider.py:4]
Traceback (most recent call last):
  File "d:\Dev\SKiDL\divider.py", line 4, in <module>
    q = Part("Device", "Q_PNP_CBE", dest=TEMPLATE, footprint="Package_TO_SOT_SMD:SOT-23")

My code:

from skidl import *

# Create part templates.
q = Part("Device", "Q_PNP_CBE", dest=TEMPLATE, footprint="Package_TO_SOT_SMD:SOT-23")
r = Part("Device", "R", dest=TEMPLATE, footprint="Resistor_SMD:R_0805_2012Metric")

# Create nets.
gnd, vcc = Net("GND"), Net("VCC")
a, b, a_and_b = Net("A"), Net("B"), Net("A_AND_B")

# Instantiate parts.
gndt = Part("power", "GND", footprint="Connector_PinHeader_2.54mm:PinHeader_1x01")
vcct = Part("power", "VCC", footprint="Connector_PinHeader_2.54mm:PinHeader_1x01")
q1, q2 = q(2)                           # Two transistors.
r1, r2, r3, r4, r5 = r(5, value="10K")  # Five 10K resistors.

# Make connections between parts.
a & r1 & q1["B C"] & r4 & q2["B C"] & a_and_b & r5 & gnd
b & r2 & q1["B"]
q1["C"] & r3 & gnd
vcc += q1["E"], q2["E"], vcct
gnd += gndt

# Generate netlist.
generate_schematic(top_name="test")

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions