+
, как правило, плохой способ построения строк в Python.
Я бы хотел заменить "convert " + filePath + " +compress " + dirPath + "/" + shortFile + ".tif"
на
import os.path
"convert %s +compress %s.tif" % (filePath, os.path.join(dirPath, shortFile))
При этом вы бы заменили весь вызов os.system
на
from subprocess import check_call, CalledProcessError
newFile = "%s.tif" % (filePath, os.path.join(dirPath, shortFile)
command = ["convert", filePath, "+compress", newFile]
try:
check_call(command)
except CalledProcessError as e:
...