@@ -481,15 +481,16 @@ def get_mbed_htm(self, mount_point):
481481
482482 def get_mbed_htm_lines (self , mount_point ):
483483 result = []
484- for mount_point_file in [f for f in listdir (mount_point ) if isfile (join (mount_point , f ))]:
485- if mount_point_file .lower () == self .MBED_HTM_NAME :
486- mbed_htm_path = os .path .join (mount_point , mount_point_file )
487- try :
488- with open (mbed_htm_path , 'r' ) as f :
489- result = f .readlines ()
490- except IOError :
491- if self .DEBUG_FLAG :
492- self .debug (self .get_mbed_htm_target_id .__name__ , ('Failed to open file' , mbed_htm_path ))
484+ if mount_point :
485+ for mount_point_file in [f for f in listdir (mount_point ) if isfile (join (mount_point , f ))]:
486+ if mount_point_file .lower () == self .MBED_HTM_NAME :
487+ mbed_htm_path = os .path .join (mount_point , mount_point_file )
488+ try :
489+ with open (mbed_htm_path , 'r' ) as f :
490+ result = f .readlines ()
491+ except IOError :
492+ if self .DEBUG_FLAG :
493+ self .debug (self .get_mbed_htm_target_id .__name__ , ('Failed to open file' , mbed_htm_path ))
493494 return result
494495
495496 def get_details_txt (self , mount_point ):
@@ -515,14 +516,15 @@ def get_details_txt(self, mount_point):
515516 Interface CRC: 0x26764ebf
516517 """
517518 result = {}
518- path_to_details_txt = os .path .join (mount_point , self .DETAILS_TXT_NAME )
519- if os .path .exists (path_to_details_txt ):
520- try :
521- with open (path_to_details_txt , 'r' ) as f :
522- result = self .parse_details_txt (f .readlines ())
523- except IOError :
524- if self .DEBUG_FLAG :
525- self .debug (self .get_mbed_fw_version .get_details_txt .__name__ , ('Failed to open file' , path_to_details_txt ))
519+ if mount_point :
520+ path_to_details_txt = os .path .join (mount_point , self .DETAILS_TXT_NAME )
521+ if os .path .exists (path_to_details_txt ):
522+ try :
523+ with open (path_to_details_txt , 'r' ) as f :
524+ result = self .parse_details_txt (f .readlines ())
525+ except IOError :
526+ if self .DEBUG_FLAG :
527+ self .debug (self .get_mbed_fw_version .get_details_txt .__name__ , ('Failed to open file' , path_to_details_txt ))
526528 return result if result else None
527529
528530 def parse_details_txt (self , lines ):
0 commit comments