Forum How do I...?

running prince from Windows batch file

jim_albright
On Windows XP

calling Prince in batch file:
call C:\Progra~1\prince\engine\bin\prince.exe -o "magic.pdf" "magic.xhtml"

I get error message
Mercury runtime: error opening standard input stream in binary mode:
fdopen() failed: Bad file descriptor


but running same code in cmd I get magic.pdf created.
call C:\Progra~1\prince\engine\bin\prince.exe -o "magic.pdf" "magic.xhtml"

I have confirmed that I am the same location when running code:
Volume in drive C has no label.
Volume Serial Number is 6898-5D25

Directory of C:\d\Research\output

05/20/2005 05:38 PM 13,679 magic.xhtml
1 File(s) 13,679 bytes
0 Dir(s) 3,815,219,200 bytes free

Volume in drive C has no label.
Volume Serial Number is 6898-5D25

Directory of C:\d\Research\output

05/20/2005 05:38 PM 13,679 magic.xhtml
1 File(s) 13,679 bytes
0 Dir(s) 3,816,681,472 bytes free


Is there a trick that I don't know?

Jim Albright
Wycliffe Bible Translators

mikeday
That's odd; I'm familiar with that error message, but can't reproduce it here, when I call Prince from a batch file it seems to work fine. Is there anything else in the batch file that might affect its behaviour? Are you running the batch file from the terminal, or explorer?
jim_albright
Very strange. I haven't come across this behavior before.

The batch file runs fine within

run/cmd

but fails when called from TextPad's shell.

But the good news is that at least one method works so I will use it.

Jim Albright
Wycliffe Bible Translators

mikeday
You could tell the TextPad developers that their program should provide a valid file handle for standard error when they execute a shell process, as some applications (like Prince) will expect one to be present. Or not, if it's not bothering you. :)
jim_albright
Thanks for the suggestion.

I upgraded TextPad and thought that it fixed the error but it didn't. Error is still there in TextPad. I did get some nice UI improvements in TextPad by upgrading though.

I will notify TextPad of the problem.

Jim Albright
Wycliffe Bible Translators

Edited by jim_albright

Worker
If the batch file truly has
call C:\Progra~1\prince\engine\bin\prince.exe

then you may want to omit the "call", which is only meant for calling one batch file from another.
C:\>help call
Calls one batch program from another.