From 6a54ee62e4b970e47115d42f61f2ba55818e8c07 Mon Sep 17 00:00:00 2001 From: crypto512 Date: Sat, 2 Jan 2021 22:59:44 +0100 Subject: [PATCH] avoid splitting path that contain space during gm identify call --- prosopopee/prosopopee.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/prosopopee/prosopopee.py b/prosopopee/prosopopee.py index f1a6149..e583aff 100644 --- a/prosopopee/prosopopee.py +++ b/prosopopee/prosopopee.py @@ -210,9 +210,7 @@ def ratio(self): + " -v error -select_streams v:0 -show_entries stream=width,height -of csv=p=0" ) command_list = command.split() - # target is Type path.Path, encodes to bytes, decodes to str, which we can append to the - # list disgusting, I know. But it works - command_list.append(target.encode().decode()) + command_list.append(str(target)) out = subprocess.check_output(command_list) width, height = out.decode("utf-8").split(",") return float(width) / int(height) @@ -384,8 +382,10 @@ def generate_thumbnail(self, gm_geometry): @property def ratio(self): - command = "gm identify -format %w,%h " + self.base_dir.joinpath(self.name) - out = subprocess.check_output(command.split()) + command = "gm identify -format %w,%h" + command_list = command.split() + command_list.append(str(self.base_dir.joinpath(self.name))) + out = subprocess.check_output(command_list) width, height = out.decode("utf-8").split(",") return float(width) / int(height)