1
1
"""Method to translate a Model to a VisualizationSet."""
2
2
import os
3
- import pathlib
4
3
import json
5
4
6
5
from ladybug_geometry .geometry3d import Point3D , Face3D
@@ -512,8 +511,8 @@ def _read_sensor_grid_result(result_folder):
512
511
break
513
512
if result_file is not None :
514
513
print (
515
- f 'Loading results for { grid_id } with { sensor_count } sensors. '
516
- f 'Starting from line { st_ln } .'
514
+ 'Loading results for {} with {} sensors. '
515
+ 'Starting from line {}.' . format ( grid_id , sensor_count , st_ln )
517
516
)
518
517
with open (result_file ) as inf :
519
518
for _ in range (st_ln ):
@@ -522,13 +521,15 @@ def _read_sensor_grid_result(result_folder):
522
521
try :
523
522
value = float (next (inf ))
524
523
except (StopIteration , ValueError ):
525
- content = pathlib .Path (result_file ).read_text ()
524
+ with open (result_file , 'r' ) as rf :
525
+ content = rf .read ()
526
526
ln_count = len (content .split ())
527
527
raise ValueError (
528
- f'Failed to load the results for { grid_id } '
529
- f'with { sensor_count } sensors. Sensor id: { count } \n '
530
- f'Here is the content of the file with { ln_count } values:\n '
531
- f'## Start of the file\n { content } \n ## End of the file.'
528
+ 'Failed to load the results for {} '
529
+ 'with {} sensors. Sensor id: {}\n '
530
+ 'Here is the content of the file with {} values:\n '
531
+ '## Start of the file\n {}\n ## End of the file.' .format (
532
+ grid_id , sensor_count , count , ln_count , content )
532
533
)
533
534
else :
534
535
results .append (value )
0 commit comments