From a3a46c5f64ea73e37a102e093c938efe80538190 Mon Sep 17 00:00:00 2001 From: Cyber-G Date: Mon, 11 Sep 2023 17:54:35 +0200 Subject: [PATCH] RawFile.py: fix https://github.com/PySpice-org/PySpice/issues/352 --- PySpice/Spice/NgSpice/RawFile.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/PySpice/Spice/NgSpice/RawFile.py b/PySpice/Spice/NgSpice/RawFile.py index 90ae7f6b1..309cf89f9 100644 --- a/PySpice/Spice/NgSpice/RawFile.py +++ b/PySpice/Spice/NgSpice/RawFile.py @@ -32,6 +32,8 @@ .. code:: + [Note:] No compatibility mode selected! OR [Note:] Compatibility modes selected: xyz + Circuit: 230V Rectifier Doing analysis at TEMP = 25.000000 and TNOM = 25.000000 @@ -189,6 +191,14 @@ def _read_header(self, stdout): raw_data = stdout[raw_data_start:] header_line_iterator = iter(header_lines) + try: + self._read_header_field_line(header_line_iterator, 'Note', has_value=False) + except Exception as e: + if 'No compatibility mode selected' in str(e): + # Reset iterator + header_line_iterator = iter(header_lines) + self._read_header_field_line(header_line_iterator, 'No compatibility mode selected', has_value=False) + self.circuit_name = self._read_header_field_line(header_line_iterator, 'Circuit') self.temperature, self.nominal_temperature = self._read_temperature_line(header_line_iterator) self.warnings = [self._read_header_field_line(header_line_iterator, 'Warning')