File tree Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -511,14 +511,25 @@ def _read_sensor_grid_result(result_folder):
511
511
result_file = os .path .join (result_folder , f )
512
512
break
513
513
if result_file is not None :
514
- print (f'Loading results for { grid_id } with { sensor_count } sensors. Starting from line { st_ln } .' )
514
+ print (
515
+ f'Loading results for { grid_id } with { sensor_count } sensors. '
516
+ f'Starting from line { st_ln } .'
517
+ )
515
518
with open (result_file ) as inf :
516
519
for _ in range (st_ln ):
517
520
next (inf )
518
- for _ in range (sensor_count ):
521
+ for count in range (sensor_count ):
519
522
try :
520
- results . append ( float (next (inf ) ))
521
- except StopIteration :
523
+ value = float (next (inf ))
524
+ except ( StopIteration , ValueError ) :
522
525
content = pathlib .Path (result_file ).read_text ()
523
- raise ValueError (f'Failed to load the results. Here is the content of the file: { content } ' )
526
+ ln_count = len (content .split ())
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.'
532
+ )
533
+ else :
534
+ results .append (value )
524
535
return results
You can’t perform that action at this time.
0 commit comments