From 2f90516822a56c63833805c8b88f732007714b04 Mon Sep 17 00:00:00 2001 From: hanhxiao Date: Fri, 16 Aug 2019 15:26:42 +0800 Subject: [PATCH] fix(setup): fix encoding problem in setup.py --- gnes/base/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gnes/base/__init__.py b/gnes/base/__init__.py index 86d76cf6..8081c1bd 100644 --- a/gnes/base/__init__.py +++ b/gnes/base/__init__.py @@ -231,7 +231,7 @@ def dump_yaml(self, filename: str = None) -> None: f = filename or self.yaml_full_path if not f: f = tempfile.NamedTemporaryFile('w', delete=False, dir=os.environ.get('GNES_VOLUME', None)).name - with open(f, 'w') as fp: + with open(f, 'w', encoding='utf8') as fp: yaml.dump(self, fp) self.logger.info('model\'s yaml config is dump to %s' % f) @@ -239,7 +239,7 @@ def dump_yaml(self, filename: str = None) -> None: def load_yaml(cls: Type[T], filename: Union[str, TextIO]) -> T: if not filename: raise FileNotFoundError if isinstance(filename, str): - with open(filename) as fp: + with open(filename, encoding='utf8') as fp: return yaml.load(fp) else: with filename: