I want to run this command ebsynth -style source_photo.png -guide source_segment.png target_segment.png -output output.png.
This works perfectly in cmd but not in python subprocess.run()
Python Code
import subprocess
process = subprocess.run(['ebsynth', '-style', 'source_photo.png', '-guide', 'source_segment.png target_segment.png', '-output', 'output.png'], shell=True, cwd=dir)
Running this I am getting error: unrecognized option 'output.png'
What is the problem?
>Solution :
ebsynth expects two filenames after the -guide option, but you’re passing those two filenames as a single string, so it’s using 'source_segment.png target_segment.png' as the first filename and '-output' as the second, causing output.png to be an unexpected option.
Try separating the filenames, like this:
process = subprocess.run(['ebsynth', '-style', 'source_photo.png', '-guide', 'source_segment.png', 'target_segment.png', '-output', 'output.png'], shell=True, cwd=dir)