Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Unrecognized Option in subprocess.run()

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

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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)
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading