From 4bc27b24c60402c5ec93f03b45681e13f565bb91 Mon Sep 17 00:00:00 2001 From: Jiahome Wu Date: Sat, 17 Dec 2022 09:44:15 +0800 Subject: [PATCH] Bugfix: explicit encoding type declaration --- postman_doc_gen/document_generator.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/postman_doc_gen/document_generator.py b/postman_doc_gen/document_generator.py index 84ce5a5..cb6256a 100644 --- a/postman_doc_gen/document_generator.py +++ b/postman_doc_gen/document_generator.py @@ -72,7 +72,7 @@ def generate_doc(self, collection_file_name: str, environment_file_name: str = N copy_tree(css_dir, os.path.join(output_dir, CSS_DIR)) copy_tree(js_dir, os.path.join(output_dir, JS_DIR)) - with open(filename, 'w') as fh: + with open(filename, 'w' , encoding='utf-8') as fh: fh.write(template.render( download_enabled=download_enabled, collection=self.api_collection, @@ -106,7 +106,7 @@ def get_json_file(file_name): :param file_name: file path :return: the json file at path """ - with open(file_name) as f: + with open(file_name, 'r', encoding='utf-8') as f: json_file = json.load(f) return json_file