diff options
author | Gwenael Lambrouin <gwenael.lambrouin@orange.com> | 2021-08-24 11:42:26 +0200 |
---|---|---|
committer | Gwenael Lambrouin <gwenael.lambrouin@orange.com> | 2021-08-24 14:41:58 +0200 |
commit | 58a44a8ea1e48ba8936485086794cb59795a2d03 (patch) | |
tree | d91beeac3df5c0ecef37eb093a5eff52c6317e37 /nfvbench/config.py | |
parent | 1574b1655e47e4c37dfaf8de8cb0a8bfcb999894 (diff) |
Be explicit about text file encoding
Python PEP 597 (https://www.python.org/dev/peps/pep-0597) recommends to use an
explicit encoding for text files instead of the default locale encoding.
Pylint 2.10 adds a new checker named unspecified-encoding for that.
The present patch adds explicit utf-8 encoding to open() calls in nfvbench and
fixes pylint unspecified-encoding warnings.
Remark: this patch does not change nfvbench behaviour on systems where utf-8 is
the locale encoding, which is generally the case on Linux systems.
Change-Id: Ic4dfb37e1ea958452a0173f7630a68f0d95071ae
Signed-off-by: Gwenael Lambrouin <gwenael.lambrouin@orange.com>
Diffstat (limited to 'nfvbench/config.py')
-rw-r--r-- | nfvbench/config.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/nfvbench/config.py b/nfvbench/config.py index c107958..8e77127 100644 --- a/nfvbench/config.py +++ b/nfvbench/config.py @@ -23,7 +23,7 @@ def config_load(file_name, from_cfg=None, whitelist_keys=None): The config file content taking precedence in case of duplicate """ try: - with open(file_name) as fileobj: + with open(file_name, encoding="utf-8") as fileobj: cfg = AttrDict(yaml.safe_load(fileobj)) except IOError: raise Exception("Configuration file at '{}' was not found. Please use correct path " |