diff --git a/sonic_sfp/sfputilbase.py b/sonic_sfp/sfputilbase.py index 122850d90..bff54c2bf 100644 --- a/sonic_sfp/sfputilbase.py +++ b/sonic_sfp/sfputilbase.py @@ -256,7 +256,10 @@ def _read_eeprom_specific_bytes(self, sysfsfile_eeprom, offset, num_bytes): sysfsfile_eeprom.seek(offset) raw = sysfsfile_eeprom.read(num_bytes) except IOError: - print("Error: reading sysfs file %s" % sysfs_sfp_i2c_client_eeprom_path) + if sysfsfile_eeprom is not None: + print("Error: reading sysfs file %s" % sysfsfile_eeprom.name) + else: + print("Error: reading sysfs, file doesn't exist") return None try: