diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/eeprom.py b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/eeprom.py index df24172709d3..a98a6bc1d45a 100644 --- a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/eeprom.py +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/eeprom.py @@ -17,7 +17,7 @@ from sonic_eeprom import eeprom_base from sonic_eeprom import eeprom_tlvinfo - from .platform_thrift_client import thrift_try + from platform_thrift_client import thrift_try except ImportError as e: raise ImportError (str(e) + "- required module not found") @@ -64,6 +64,11 @@ EEPROM_SYMLINK = "/var/run/platform/eeprom/syseeprom" EEPROM_STATUS = "/var/run/platform/eeprom/status" +try: + _str_type = basestring +except NameError: + _str_type = str + class Eeprom(eeprom_tlvinfo.TlvInfoDecoder): def __init__(self): @@ -101,7 +106,7 @@ def eeprom_parse(self): f.close() eeprom_params = "" - for attr, val in self.eeprom.__dict__.iteritems(): + for attr, val in self.eeprom.__dict__.items(): if val is None: continue @@ -109,7 +114,7 @@ def eeprom_parse(self): if elem is None: continue - if isinstance(val, basestring): + if isinstance(val, _str_type): value = val.replace('\0', '') else: value = str(val)