fixed the issue where subprocess tries to execute pathlib.Path

This commit is contained in:
k4yt3x 2019-08-03 19:45:22 -04:00
parent 685d894bef
commit e3b2624977
3 changed files with 19 additions and 8 deletions

View File

@ -4,7 +4,7 @@
Name: Waifu2x Caffe Driver Name: Waifu2x Caffe Driver
Author: K4YT3X Author: K4YT3X
Date Created: Feb 24, 2018 Date Created: Feb 24, 2018
Last Modified: July 27, 2019 Last Modified: August 3, 2019
Description: This class is a high-level wrapper Description: This class is a high-level wrapper
for waifu2x-caffe. for waifu2x-caffe.
@ -67,9 +67,9 @@ class Waifu2xCaffe:
self.print_lock.release() self.print_lock.release()
# list to be executed # list to be executed
execute = [] # initialize the list with waifu2x binary path as the first element
execute = [str(self.waifu2x_settings['waifu2x_caffe_path'])]
execute.append(self.waifu2x_settings['waifu2x_caffe_path'])
for key in self.waifu2x_settings.keys(): for key in self.waifu2x_settings.keys():
value = self.waifu2x_settings[key] value = self.waifu2x_settings[key]

View File

@ -4,7 +4,7 @@
Name: Waifu2x Converter CPP Driver Name: Waifu2x Converter CPP Driver
Author: K4YT3X Author: K4YT3X
Date Created: February 8, 2019 Date Created: February 8, 2019
Last Modified: July 27, 2019 Last Modified: August 3, 2019
Description: This class is a high-level wrapper Description: This class is a high-level wrapper
for waifu2x-converter-cpp. for waifu2x-converter-cpp.
@ -72,7 +72,8 @@ class Waifu2xConverter:
self.print_lock.release() self.print_lock.release()
# list to be executed # list to be executed
execute = [] # initialize the list with waifu2x binary path as the first element
execute = [str(pathlib.Path(self.waifu2x_settings['waifu2x_converter_path']) / 'waifu2x-converter-cpp.exe')]
for key in self.waifu2x_settings.keys(): for key in self.waifu2x_settings.keys():
@ -80,7 +81,7 @@ class Waifu2xConverter:
# the key doesn't need to be passed in this case # the key doesn't need to be passed in this case
if key == 'waifu2x_converter_path': if key == 'waifu2x_converter_path':
execute.append(pathlib.Path(str(value)) / 'waifu2x-converter-cpp.exe') continue
# null or None means that leave this option out (keep default) # null or None means that leave this option out (keep default)
elif value is None or value is False: elif value is None or value is False:

View File

@ -4,7 +4,7 @@
Name: Waifu2x NCNN Vulkan Driver Name: Waifu2x NCNN Vulkan Driver
Author: SAT3LL Author: SAT3LL
Date Created: June 26, 2019 Date Created: June 26, 2019
Last Modified: July 27, 2019 Last Modified: August 3, 2019
Dev: K4YT3X Dev: K4YT3X
@ -74,17 +74,25 @@ class Waifu2xNcnnVulkan:
'verbose': '-v' 'verbose': '-v'
} }
execute = [self.waifu2x_settings['waifu2x_ncnn_vulkan_path']] # list to be executed
# initialize the list with waifu2x binary path as the first element
execute = [str(self.waifu2x_settings['waifu2x_ncnn_vulkan_path'])]
for key in self.waifu2x_settings.keys(): for key in self.waifu2x_settings.keys():
value = self.waifu2x_settings[key] value = self.waifu2x_settings[key]
if key == 'waifu2x_ncnn_vulkan_path': if key == 'waifu2x_ncnn_vulkan_path':
continue continue
elif key == 'input': elif key == 'input':
execute.append(waifu2x_ncnn_vulkan_opt_flag[key]) execute.append(waifu2x_ncnn_vulkan_opt_flag[key])
execute.append(input_directory) execute.append(input_directory)
elif key == 'output': elif key == 'output':
execute.append(waifu2x_ncnn_vulkan_opt_flag[key]) execute.append(waifu2x_ncnn_vulkan_opt_flag[key])
execute.append(output_directory) execute.append(output_directory)
elif key == 'scale-ratio': elif key == 'scale-ratio':
execute.append(waifu2x_ncnn_vulkan_opt_flag[key]) execute.append(waifu2x_ncnn_vulkan_opt_flag[key])
# waifu2x_ncnn_vulkan does not accept an arbitrary scale ratio, max is 2 # waifu2x_ncnn_vulkan does not accept an arbitrary scale ratio, max is 2
@ -92,9 +100,11 @@ class Waifu2xNcnnVulkan:
execute.append('1') execute.append('1')
else: else:
execute.append('2') execute.append('2')
# allow upper if cases to take precedence # allow upper if cases to take precedence
elif value is None or value is False: elif value is None or value is False:
continue continue
else: else:
execute.append(waifu2x_ncnn_vulkan_opt_flag[key]) execute.append(waifu2x_ncnn_vulkan_opt_flag[key])
execute.append(str(value)) execute.append(str(value))