DasBasti / lcsc2kicad

Generate KiCAD Part Libraries based on LCSC PCBA database
27 stars 3 forks source link

UnicodeEncodeError #1

Open ArchieAtkinson opened 3 years ago

ArchieAtkinson commented 3 years ago

I seem to have run into a UnicodeEncodeError while trying to run this. Any ideas?

load: DCM template            
load: templates\Aluminum Electrolytic Capacitors - SMD.lib        
load: templates\Beads.lib
load: templates\Chip Resistor - Surface Mount.lib
load: templates\EEPROM.lib
load: templates\Ferrite Beads.lib
load: templates\HF Inductors.lib
load: templates\Inductors SMD.lib
load: templates\Light Emitting Diodes LED.lib
load: templates\Multilayer Ceramic Capacitors MLCC - SMDSMT.lib
load: templates\Schottky Barrier Diodes SBD.lib
load: templates\Switching Diode.lib
load: templates\Tantalum Capacitors.lib
load: templates\TVS.lib
load: templates\Zener Diodes.lib
fetch file from JLCPCB
parsing data. This might take a while!
Library: Resistors
Group: Resistor Networks & Arrays
Group: Chip Resistor - Surface Mount
Group: Low Resistors & Current Sense Resistors - Surface Mount
Group: Varistors
Group: NTC Thermistors
Group: Metal Alloy Resistors
Group: High Precision & Low TCR SMD Resistors
Group: Variable Resistors
Group: High Voltage Resistor
Group: LED Strip Resistors
Group: Potentiometers & Variable Resistors
Group: Precision Potentiometer
Group: Wirewound Resistors
Traceback (most recent call last):
  File ".\generate.py", line 82, in <module>
    l.write(lib_str)
  File "C:\Users\Archie\AppData\Local\Programs\Python\Python38-32\lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u03a9' in position 3082810: character maps to <undefined>
DasBasti commented 3 years ago

Sorry it took me so long. I did not check the script under windows. \u03a9 is the Ω and is not available in codepage1252 encoding which seams to be the default in windows. I updated the script to use UTF-8 encoding. Can you give it a try?