diff --git a/easyeda2kicad/__main__.py b/easyeda2kicad/__main__.py index 7cca178..a4bec62 100644 --- a/easyeda2kicad/__main__.py +++ b/easyeda2kicad/__main__.py @@ -158,7 +158,7 @@ def valid_arguments(arguments: dict) -> bool: "easyeda2kicad", ) if not os.path.isdir(default_folder): - os.mkdir(default_folder) + os.makedirs(default_folder, exist_ok=True) base_folder = default_folder lib_name = "easyeda2kicad" diff --git a/easyeda2kicad/helpers.py b/easyeda2kicad/helpers.py index 88fde06..7b06c6b 100644 --- a/easyeda2kicad/helpers.py +++ b/easyeda2kicad/helpers.py @@ -43,11 +43,7 @@ def set_logger(log_file: str, log_level: int) -> None: def sanitize_for_regex(field: str): - field = sanitize_fields(field) - chars_to_escape = r"(){}[],;.|\+-?*#^:$" - for char in chars_to_escape: - field = field.replace(char, rf"\{char}") - return field + return re.escape(field) def id_already_in_symbol_lib(