I am creating a paint-like app in Python and I am saving the canvas using Ghostscript with subprocess inside python. The script works fine and I get the desired output, but If there is any blank space in the destination, Ghostscript breaks at that point and returns an error. eg :
destination = "/Volumes/Personal/Personal Works/myImage"
convertCode = "gs -dSAFER -dNOPAUSE -dBATCH -r300 -g1000x1000 -sDEVICE=pngalpha -sOutputFile=" + destination + ".png " + tempFile
subprocess.call(convertCode, shell=True)
This returns an
Error: /undefinedfilename in (Works/Untitled.png)
this clearly shows the Ghostscript breaks due to the space in the destination name. Destination with no space in the middle has no problem. How to solve this problem.