From b033d75d6060827272c1589aa18ec5d1822db646 Mon Sep 17 00:00:00 2001 From: Moooog Date: Thu, 20 Oct 2022 15:02:16 +0100 Subject: [PATCH 1/3] Update __init__.py --- pipreqs/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipreqs/__init__.py b/pipreqs/__init__.py index 0491276..79ecee4 100755 --- a/pipreqs/__init__.py +++ b/pipreqs/__init__.py @@ -1,3 +1,3 @@ __author__ = 'Vadim Kravcenko' __email__ = 'vadim.kravcenko@gmail.com' -__version__ = '0.4.11' +__version__ = '0.4.12' From b6e0e3a71111029fc3f787c6fa90e49f265f961c Mon Sep 17 00:00:00 2001 From: Moooog Date: Thu, 20 Oct 2022 15:02:53 +0100 Subject: [PATCH 2/3] Update pipreqs.py UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 1477: character maps to Ignore cp1252 encoding error (cp850 works as default but isnt recommended so ignoring the error is preferred and will successfully write requirement file) --- pipreqs/pipreqs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipreqs/pipreqs.py b/pipreqs/pipreqs.py index 24eeeb7..56b8c37 100644 --- a/pipreqs/pipreqs.py +++ b/pipreqs/pipreqs.py @@ -111,7 +111,7 @@ def get_all_imports( candidates += [os.path.splitext(fn)[0] for fn in files] for file_name in files: file_name = os.path.join(root, file_name) - with open(file_name, "r", encoding=encoding) as f: + with open(file_name, "r", encoding=encoding, errors='ignore') as f: contents = f.read() try: tree = ast.parse(contents) From 721dbcbc08a3ae64bb5e4bb920954e708026fd48 Mon Sep 17 00:00:00 2001 From: Moooog Date: Thu, 20 Oct 2022 19:10:12 +0000 Subject: [PATCH 3/3] Update pipreqs.py Add error="ignore" to both open() --- pipreqs/pipreqs.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pipreqs/pipreqs.py b/pipreqs/pipreqs.py index 56b8c37..9e6a084 100644 --- a/pipreqs/pipreqs.py +++ b/pipreqs/pipreqs.py @@ -111,7 +111,7 @@ def get_all_imports( candidates += [os.path.splitext(fn)[0] for fn in files] for file_name in files: file_name = os.path.join(root, file_name) - with open(file_name, "r", encoding=encoding, errors='ignore') as f: + with open(file_name, "r", encoding=encoding, errors="ignore") as f: contents = f.read() try: tree = ast.parse(contents) @@ -202,7 +202,7 @@ def get_locally_installed_packages(encoding=None): for item in files: if "top_level" in item: item = os.path.join(root, item) - with open(item, "r", encoding=encoding) as f: + with open(item, "r", encoding=encoding, errors="ignore") as f: package = root.split(os.sep)[-1].split("-") try: package_import = f.read().strip().split("\n")