running non-python progs from python

Marc Boeren M.Boeren at guidance.nl
Wed Dec 10 08:25:21 EST 2003


Hi,

> Spiffy wrote:
> > > that indicates that it's supposed to work, don't you think?
> > IT COULD HAVE BEEN A MISPRINT, DON'T YOU THINK?

I can understand that you get frustrated that os.system doesn't seem to
work, but there's no need to shout.

I've read the thread, and noticed one odd thing. You said that if you
execute:

C:\Python22>playb Canyon.mid

from the command line, it works.
Later, you try to execute 'C:\Python22\playb.exe' with Canyon.mid as a
parameter.

Did it occur to you that playb.exe may not be located in C:\Python22\ at
all? 
The command-line you said you executed starts playb from within the Python22
folder, but it could have found playb.exe anywhere in your Windows PATH.

Can you locate playb.exe on you hard-drive using the Windows Explorer? What
is the exact location the program appears in? Try to use that in you call to
os.system.

One other useful technique to track down a problem:

import os
program = r"C:\Windows\playb.exe"
filename = r"D:\MIDI\anyfile.mid"
commandline = "%s %s" % (program, filename)
print commandline
os.system(commandline)

This will print the complete command-line first. You can copy/paste this to
a DOS-box and execute it (from within any directory) and see what happens.

Good luck,

Cheerio, Marc.





More information about the Python-list mailing list