Skip to content

Layout JSON loading error #3

@SnappierSoap318

Description

@SnappierSoap318

Error output:

kle2netlist.exe --layout .\frl_tkl_4macro_converted.json --lib-path "C:\Program Files\KiCad\7.0\share\kicad\symbols"
WARNING: KICAD_SYMBOL_DIR environment variable is missing, so the default KiCad symbol libraries won't be searched.
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ C:\Python311\Lib\site-packages\kle2netlist\__main__.py:89 in main                                │
│                                                                                                  │
│    86 │                                                                                          │
│    87 │   try:                                                                                   │
│    88 │   │   with open(layout) as f:                                                            │
│ ❱  89 │   │   │   json_layout = json.loads(f.read())                                             │
│    90 │   │   │   build_circuit(                                                                 │
│    91 │   │   │   │   json_layout,                                                               │
│    92 │   │   │   │   switch_footprint=switch_footprint,                                         │
│                                                                                                  │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │   controller_circuit = False                                                                 │ │
│ │      diode_footprint = 'Diode_SMD:D_SOD-123F'                                                │ │
│ │                    f = <_io.TextIOWrapper name='frl_tkl_4macro_converted.json' mode='r'      │ │
│ │               layout = WindowsPath('frl_tkl_4macro_converted.json')                          │ │
│ │            lib_paths = ['C:\\Program Files\\KiCad\\7.0\\share\\kicad\\symbols']              │ │
│ │                 name = 'keyboard'                                                            │ │
│ │               no_xml = False                                                                 │ │
│ │               output = WindowsPath('.')                                                      │ │
│ │ stabilizer_footprint = 'PCM_Mounting_Keyboard_Stabilizer:Stabilizer_Cherry_MX_{:.2f}u'       │ │
│ │     switch_footprint = 'PCM_Switch_Keyboard_Cherry_MX:SW_Cherry_MX_PCB_{:.2f}u'              │ │
│ │              version = None                                                                  │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                                  │
│ C:\Python311\Lib\encodings\cp1252.py:23 in decode                                                │
│                                                                                                  │
│    20                                                                                            │
│    21 class IncrementalDecoder(codecs.IncrementalDecoder):                                       │
│    22 │   def decode(self, input, final=False):                                                  │
│ ❱  23 │   │   return codecs.charmap_decode(input,self.errors,decoding_table)[0]                  │
│    24                                                                                            │
│    25 class StreamWriter(Codec,codecs.StreamWriter):                                             │
│    26 │   pass                                                                                   │
│                                                                                                  │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │ final = True                                                                                 │ │
│ │ input = b'{\n  "meta": {\n    "author": "Snappy",\n    "backcolor": "#ffffff",\n             │ │
│ │         "backgroun'+51375                                                                    │ │
│ │  self = <encodings.cp1252.IncrementalDecoder object at 0x000002E7C2248910>                   │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
UnicodeDecodeError: 'charmap' codec can't decode byte 0x90 in position 49562: character maps to <undefined>

Possible fix here:
https://github.com/adamws/kle2netlist/blame/30900205560098094598d39fc0f25dc5b591d336/src/kle2netlist/__main__.py#L78

to change to

with open(layout, 'r', encoding = 'utf8') as f:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions