99designs / colorific

Automatic color palette detection
ISC License
700 stars 55 forks source link

CalledProcessError when calling colorific using subprocess.check_output #21

Open Antrikshy opened 10 years ago

Antrikshy commented 10 years ago

I can do colorific photo.jpg from Terminal just fine, but when I try this in Python, it fails:

colorific_results.append(subprocess.check_output(['colorific', colorific_param]))

Here, colorific_param is just photo_0.jpg. I get:

subprocess.CalledProcessError: Command '['colorific', 'photo_0.jpg']' returned non-zero exit status 1

Any ideas? I am not adamant on using subprocess, but it just felt easier. I can include colorific in my code if I can figure out how to import it. I just want the functionality that I get when normally using the command and I was unsure on which function to call from my script.

The expected end result is a list or dictionary of output (as strings) from several photos in the current directory.

larsyencken commented 9 years ago

Super belated follow-up:

You've found a bug with the use of images as direct arguments. Originally, colorific was intended to be passed in images one at a time on stdin. The exit behaviour is correct if you call it this way.

>>> import subprocess
>>> subprocess.check_output(['colorific'], input=b'nasa_ares_logo.png')
b'nasa_ares_logo.png\t#0065b9,#bbd6ec,#ff0000\t\n'

Hope that helps.