From c7200b15ee8b0e0f1a7fc52187b5ffa99e80d43d Mon Sep 17 00:00:00 2001 From: xxyzz Date: Tue, 7 Dec 2021 10:22:35 +0800 Subject: [PATCH] open subprocess's stderr in text mode --- __init__.py | 2 +- main.py | 2 +- unzip.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/__init__.py b/__init__.py index 21d3eee..7048662 100644 --- a/__init__.py +++ b/__init__.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 from calibre.customize import InterfaceActionBase -VERSION = (3, 14, 3) +VERSION = (3, 14, 4) class WordDumbDumb(InterfaceActionBase): diff --git a/main.py b/main.py index 12d504a..1d67fe1 100644 --- a/main.py +++ b/main.py @@ -102,7 +102,7 @@ def job_failed(self, job): return False def subprocess_error(self, job): - exception = job.exception.stderr.decode('utf-8') + exception = job.exception.stderr if 'C++ Build Tools' in exception: self.error_dialog( 'Seriously, 32bit?!', diff --git a/unzip.py b/unzip.py index 2bdde22..a965068 100644 --- a/unzip.py +++ b/unzip.py @@ -81,10 +81,10 @@ def pip_install(pkg, pkg_version, compiled=False, url=None, notif.put((0, f'Installing {pkg}')) args = pip_args(pkg, pkg_version, compiled, url) if iswindows: - subprocess.run(args, check=True, capture_output=True, + subprocess.run(args, check=True, capture_output=True, text=True, creationflags=subprocess.CREATE_NO_WINDOW) else: - subprocess.run(args, check=True, capture_output=True) + subprocess.run(args, check=True, capture_output=True, text=True) def pip_args(pkg, pkg_version, compiled, url):