added command return value check

This commit is contained in:
k4yt3x 2019-03-04 19:35:16 -05:00
parent 406b87cc70
commit 1f8dc0dd47
2 changed files with 8 additions and 5 deletions

View File

@ -4,7 +4,7 @@
Name: Waifu2x Caffe Driver
Author: K4YT3X
Date Created: Feb 24, 2018
Last Modified: February 8, 2019
Last Modified: March 4, 2019
Description: This class controls waifu2x
engine
@ -45,9 +45,11 @@ class Waifu2xCaffe:
self.print_lock.release()
# Create string for execution
# execute = ['{}'.format(self.waifu2x_path), '-p', self.method, '-I', 'png', '-i', '\"{}\"'.format(folderin), '-e', 'png', '-o', folderout, '-w', str(width), '-h', str(height), '-n', '3', '-m', 'noise_scale', '-y', self.model_type]
execute = '\"{}\" -p {} -I png -i \"{}\" -e png -o {} -w {} -h {} -n 3 -m noise_scale -y {}'.format(
self.waifu2x_path, self.method, folderin, folderout, width, height, self.model_type)
subprocess.call(execute)
print('Executing: {}'.format(execute))
subprocess.run(execute, shell=True, check=True)
# Print thread exiting message
self.print_lock.acquire()

View File

@ -4,7 +4,7 @@
Name: Waifu2x Converter CPP Driver
Author: K4YT3X
Date Created: February 8, 2019
Last Modified: February 8, 2019
Last Modified: March 4, 2019
Description: This class controls waifu2x
engine
@ -44,9 +44,10 @@ class Waifu2xConverter:
self.print_lock.release()
# Create string for execution
execute = '\"{}\\waifu2x-converter-cpp.exe\" -i \"{}\" -o {} --scale_ratio {} --noise_level 3 -m noise_scale -j {} --model_dir {}\\models_rgb'.format(
execute = '\"{}\\waifu2x-converter-cpp.exe\" -q -i \"{}\" -o {} --scale_ratio {} --noise_level 3 -m noise_scale -j {} --model_dir {}\\models_rgb'.format(
self.waifu2x_path, folderin, folderout, scale_ratio, threads, self.waifu2x_path)
subprocess.call(execute)
print('Executing: {}'.format(execute))
subprocess.run(execute, check=True)
# Print thread exiting message
self.print_lock.acquire()