Skip to content

The OUTPUTFILE needs to be enquoted for the shell commands to work with paths that have spaces #3

Description

@xandark

The script would bomb when I ran it because my paths have a space in it:

convert: unable to open image `../Images': No such file or directory @ error/blob.c/OpenBlob/2709.
convert: no decode delegate for this image format `' @ error/constitute.c/ReadImage/501.
convert: unable to open image `II/Aztec.dsk.png': No such file or directory @ error/blob.c/OpenBlob/2709.
convert: WriteBlob Failed `II/Aztec.dsk.png' @ error/png.c/MagickPNGErrorHandler/1645.

By enquoting OUTPUTFILE it is more robust:

os.system('convert DiskImageTEMP.png -matte -virtual-pixel transparent -resize 1024x1024! -rotate 90 -distort Polar \'512 110 512,512 -180,180\' "' + OUTPUTFILE + '"')

Note the two extra " 's

This had to be done for the next line as well:

os.system('xdg-open "' + OUTPUTFILE + '"')

I had to change open to xdg-open because "open" would generate this message on my Kubuntu Linux machine:

Couldn't get a file descriptor referring to the console

"open" is not a shell command under Linux, where xdg-open is the Cross Desktop Group's standard way to open any file with its assigned type handler.

But otherwise, this cool script is now working :)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions