Converting tiff file to tx file through maketx utility



This is tne format of maketx.exe command

maketx -v -u --oiio --checknan --filter lanczos3 inputFile.tiff -o fileOut.tx

I can successfully convert my tiff files to tx files by running it on cmd.exe

But when I call this command through subprocess.Popen() like this

subprocess.Popen(["maketx.exe", "-v -u --oiio --checknan --filter lanczos3", "inputFile.tiff", "-o", "fileOut.tx"])

It gives me this error

Invalid option " -v -u --oiio --checknan --filter lanczos3"
am I missing something or I’m using subprocess wrong way?


In the Python subprocess Popen documentation it states:

If args is a string, the interpretation is platform-dependent and described below. See the shell and executable arguments for additional differences from the default behavior. Unless otherwise stated, it is recommended to pass args as a sequence.

Considering you are using an exe I assume you are on Windows, which further states:

A string surrounded by double quotation marks is interpreted as a single argument, regardless of white space contained within. A quoted string can be embedded in an argument.

So to me it looks like that invalid statement is being interpreted as a single argument, but those are multiple args, so you should convert it to a sequence like the others.


Yeah, my guess is that @sev nailed it. Try something like this:

subprocess.Popen(["maketx.exe", "-v",  "-u",  "--oiio", "--checknan", "--filter", "lanczos3", "inputFile.tiff", "-o", "fileOut.tx"])


Yes! It worked! Thanks