1

This works in my terminal:

find "/tmp/pic" \( -iname *.JPG  \) | parallel -j 3 convert {} -resize 1920x -quality 60 "/tmp/pic2/{/}"

This doesn't work with python:

from subprocess import call
import shlex

call(shlex.split('find "/tmp/pic" \( -iname *.JPG  \) | parallel -j 3 convert {} -resize 1920x -quality 60 "/tmp/pic2/{/}"'), shell=True)

I've found this question with the same error. But the suggested solution (shell=True) doesn't work. The solution with os.walk described of @abarnert sounds logical, but I just would like to understand what is wrong in my code.

flowerflower
  • 327
  • 1
  • 3
  • 10

1 Answers1

0

The shell does the splitting for you:

from subprocess import call

call('find "/tmp/pic" \( -iname *.JPG  \) | parallel -j 3 convert {} -resize 1920x -quality 6\
0 "/tmp/pic2/{/}"', shell=True)
Ole Tange
  • 31,768
  • 5
  • 86
  • 104