From 3ad6ce1cf22b29dd371850275dbfa0dbabf428e0 Mon Sep 17 00:00:00 2001 From: muneersyed156 Date: Tue, 13 Oct 2020 16:40:03 +0530 Subject: [PATCH] Unicode error resolved while opening a file with utf-8 encoding --- comment_parser/comment_parser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comment_parser/comment_parser.py b/comment_parser/comment_parser.py index 04d5ba6..4baa21d 100755 --- a/comment_parser/comment_parser.py +++ b/comment_parser/comment_parser.py @@ -75,7 +75,7 @@ def extract_comments(filename, mime=None): Raises: UnsupportedError: If filename is of an unsupported MIME type. """ - with open(filename, 'r') as code: + with open(filename, 'r', encoding="utf-8") as code: return extract_comments_from_str(code.read(), mime)