fix python2 compatibility

String literal interpolation is not supported by Python < 3.6
This commit is contained in:
Samuel Sadok
2020-05-26 20:12:42 +02:00
parent 81f8dd2fe9
commit 2b38ce7513
+3 -3
View File
@@ -90,7 +90,7 @@ def find_all(path, serial_number,
fp.seek(0)
json_data = json.load(fp)
except:
logger.debug(f"Failed load JSON cache file {cache_path}")
logger.debug("Failed load JSON cache file {}".format(cache_path))
# Fallback to loading JSON from device
if json_data is None:
@@ -108,11 +108,11 @@ def find_all(path, serial_number,
# Save JSON to cache
if not cache_path is None:
logger.debug(f"Creating new JSON cache file {cache_path}")
logger.debug("Creating new JSON cache file {}".format(cache_path))
os.makedirs(cache_dir, exist_ok=True)
with open(cache_path, 'w+') as json_cache:
json_cache.write(json_string)
logger.debug(f"Saved JSON to cache file {cache_path}")
logger.debug("Saved JSON to cache file {}".format(cache_path))
channel._interface_definition_crc = json_crc16