Skip to content

Commit

Permalink
fix: add detailed message for loading results
Browse files Browse the repository at this point in the history
This will be helpful for debugging the rare cases that fail on Pollination.
  • Loading branch information
mostaphaRoudsari committed Feb 16, 2024
1 parent 1127475 commit bd83064
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion honeybee_display/model.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Method to translate a Model to a VisualizationSet."""
import os
import pathlib
import json

from ladybug_geometry.geometry3d import Point3D, Face3D
Expand Down Expand Up @@ -510,9 +511,14 @@ def _read_sensor_grid_result(result_folder):
result_file = os.path.join(result_folder, f)
break
if result_file is not None:
print(f'Loading results for {grid_id} with {sensor_count} sensors. Starting from line {st_ln}.')
with open(result_file) as inf:
for _ in range(st_ln):
next(inf)
for _ in range(sensor_count):
results.append(float(next(inf)))
try:
results.append(float(next(inf)))
except StopIteration:
content = pathlib.Path(result_file).read_text()
raise ValueError(f'Failed to load the results. Here is the content of the file: {content}')
return results

0 comments on commit bd83064

Please sign in to comment.