I have a bash script that has calls to the "convert" command in ImageMagick. This script works fine when I execute it in the terminal manually. Clearly I have the path to the 'convert' command added to my system path. When I try to execute it using a another script(written in python) , I run into an error the 'convert' is not found. Here is a simple example to reproduce the issue. I am on OSX Maverick.
Shell script: convert_svg_to_png.sh
#!/bin/bash
for filename in *.svg; do
convert "$filename" "`basename $filename .svg`.png"
done
Python script: runme.py
import subprocess
subprocess.call('./convert_svg_to_png.sh')
Error: ./convert_svg_to_png.sh: line 5: convert: command not found
Any idea why this error?
Edit: When the bash script is modified to include the whole path to the convert function. This new error pops up:
dyld: Library not loaded: /ImageMagick-6.8.9/lib/libMagickCore-6.Q16.2.dylib Referenced from: %FullPath%convert Reason: image not found
The shell being called by python is /bin/bash. Same as in my terminal.