Skip to content

Commit 6a54ee6

Browse files
crypto512Psycojoker
authored andcommitted
avoid splitting path that contain space during gm identify call
1 parent 87723a7 commit 6a54ee6

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

prosopopee/prosopopee.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,7 @@ def ratio(self):
210210
+ " -v error -select_streams v:0 -show_entries stream=width,height -of csv=p=0"
211211
)
212212
command_list = command.split()
213-
# target is Type path.Path, encodes to bytes, decodes to str, which we can append to the
214-
# list disgusting, I know. But it works
215-
command_list.append(target.encode().decode())
213+
command_list.append(str(target))
216214
out = subprocess.check_output(command_list)
217215
width, height = out.decode("utf-8").split(",")
218216
return float(width) / int(height)
@@ -384,8 +382,10 @@ def generate_thumbnail(self, gm_geometry):
384382

385383
@property
386384
def ratio(self):
387-
command = "gm identify -format %w,%h " + self.base_dir.joinpath(self.name)
388-
out = subprocess.check_output(command.split())
385+
command = "gm identify -format %w,%h"
386+
command_list = command.split()
387+
command_list.append(str(self.base_dir.joinpath(self.name)))
388+
out = subprocess.check_output(command_list)
389389
width, height = out.decode("utf-8").split(",")
390390
return float(width) / int(height)
391391

0 commit comments

Comments
 (0)