running a dos program and catching the output

G

Guy Robinson

Hello,

This works and correctly outputs the file out2.dwf

import os
test = os.popen("rewrite.exe test.dwf out2.dwf /a")

for L in test.readlines():
print L

this prints the statistics from the translation.

The things is I want to capture the output file for further processing.
I tried this:

infile = 'test.dwf'
outfile = 'out3.dwf'

os.spawnl(os.P_WAIT,'rewrite.exe',infile,outfile,'/a')

And it doesn't work, what am I doing wrong? The dos box disappears too
qucikly to see what the error is and ideally I don't want to see a dos
box anyway.

Regards,

Guy
 
M

Miki Tebeka

Hello Guy,
os.spawnl(os.P_WAIT,'rewrite.exe',infile,outfile,'/a')

And it doesn't work, what am I doing wrong?
IIRC the 1'st argument (to the program) should be the program name.
os.spawnl(os.P_WAIT,'rewrite.exe','rewrite.exe', infile,outfile,'/a')
The dos box disappears too qucikly to see what the error is and ideally I don't want to see a dos box anyway.
Try redirecting the output to a file to catch the error.

HTH.
Miki
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,272
Latest member
MaricruzDu

Latest Threads

Top