Skip to content

Commit 3fcf881

Browse files
committed
fix: strip inline SMV comments (from vent parser, improve log_error
_load_vents failed with 'could not convert string to float: !' on FDS 6.9.0+ output. Starting with FDS 6.9.0, the SMV writer appends an inline obstruction reference as a comment to non-dummy vent lines in the second pass (e.g. '13 15 0 0 99 0 ! 3'). Fixed by stripping everything from '!' onward before tokenizing in read_common_info and read_common_info2. Also improved log_error decorator: full traceback is now included in the warning output (exc_info=True) so errors are no longer silently swallowed. Removed unused sys import. Fixes #109, #90, #82.
1 parent f111bea commit 3fcf881

2 files changed

Lines changed: 13 additions & 11 deletions

File tree

fdsreader/simulation.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -475,11 +475,13 @@ def _load_vents(self, smv_file: TextIO, mesh: Mesh):
475475
temp_data = list()
476476

477477
def read_common_info():
478-
line = smv_file.readline().strip().split()
478+
# Strip inline FDS comments (everything from '!' onward) before parsing
479+
line = smv_file.readline().split("!")[0].strip().split()
479480
return line, [float(line[i]) for i in range(6)], int(line[6]) - 1, self.surfaces[int(line[7])]
480481

481482
def read_common_info2():
482-
line = smv_file.readline().strip().split()
483+
# Strip inline FDS comments (everything from '!' onward) before parsing
484+
line = smv_file.readline().split("!")[0].strip().split()
483485
bound_indices = tuple(int(line[i]) for i in range(6))
484486
color_index = int(line[6])
485487
draw_type = int(line[7])

fdsreader/utils/misc.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import logging
2-
import sys
32
from functools import wraps
43

54
from fdsreader import settings
@@ -14,14 +13,15 @@ def wrapped(*args, **kwargs):
1413
except Exception as e:
1514
if settings.DEBUG:
1615
raise e
17-
elif not settings.IGNORE_ERRORS:
18-
e = type(e)(
19-
f"Module {str(module)}: {str(e)}\nThe error can be safely ignored if not requiring the"
20-
f" {str(module)} module. However, please consider to submit an issue on Github including"
21-
f" the error message, the stack trace and your FDS input-file so we can reproduce the"
22-
f" error and fix it as soon as possible!"
23-
).with_traceback(sys.exc_info()[2])
24-
logging.warning(e)
16+
else:
17+
msg = (
18+
f"Module {str(module)}: {str(e)}\n"
19+
f"The error can be safely ignored if not requiring the {str(module)} module.\n"
20+
f"Please consider submitting an issue on GitHub including the error message,\n"
21+
f"the stack trace and your FDS input-file so we can reproduce and fix it."
22+
)
23+
if not settings.IGNORE_ERRORS:
24+
logging.warning(msg, exc_info=True)
2525

2626
return wrapped
2727

0 commit comments

Comments
 (0)