From e54d6a657eae00f701a9719510edd66b02af4ec8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Lanzend=C3=B6rfer?= Date: Fri, 25 Jul 2025 15:17:52 +0100 Subject: [PATCH 1/2] Solve loading of letters The letter element dictionary had not been initialized properly, this patch makes sure that the dict has been initialized, preventing crashes in lctime --- PySpice/Spice/Parser/HighLevelParser.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/PySpice/Spice/Parser/HighLevelParser.py b/PySpice/Spice/Parser/HighLevelParser.py index 9b34e3239..a15daea93 100644 --- a/PySpice/Spice/Parser/HighLevelParser.py +++ b/PySpice/Spice/Parser/HighLevelParser.py @@ -84,7 +84,9 @@ from ..Netlist import Node from ..StringTools import remove_multi_space from . import Ast -from . import ElementData +from PySpice.Spice.Parser.ElementData import elements as ElementData_elements +from PySpice.Spice.Parser.ElementData import _init as ElementData_init + from .Ast import AstNode from .Parser import SpiceParser from .SpiceSyntax import ElementLetters @@ -313,7 +315,9 @@ def __init__(self, line: SpiceLine, ast: AstNode) -> None: # Read nodes self._nodes = [] number_of_pins = 0 - data = ElementData.elements[self._letter] + if(len(ElementData_elements)==0): + ElementData_init() + data = ElementData_elements[self._letter] if not data.has_variable_number_of_pins: number_of_pins = data.number_of_pins else: # Q or X From 7df35806533cedef6e5d9300391183c8549e6256 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Lanzend=C3=B6rfer?= Date: Thu, 31 Jul 2025 13:09:34 +0100 Subject: [PATCH 2/2] Catching more stderror outputs NGSpice now writes warnings to stderror apparently. In order to keep going when trying to characterize our cells with CharLib, I need to discard some errors when the slew rate is too small in some circumstances. --- PySpice/Spice/NgSpice/Shared.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/PySpice/Spice/NgSpice/Shared.py b/PySpice/Spice/NgSpice/Shared.py index 34ad86f44..9423b2d3a 100644 --- a/PySpice/Spice/NgSpice/Shared.py +++ b/PySpice/Spice/NgSpice/Shared.py @@ -627,6 +627,10 @@ def _send_char(message_c, ngspice_id, user_data): func = self._logger.warning elif 'Note:' in content: func = self._logger.info + elif 'doAnalyses' in content: + func = self._logger.info + elif 'run simulation(s) aborted' in content: + func = self._logger.info else: self._error_in_stderr = True func = self._logger.error