By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,853 Members | 1,012 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,853 IT Pros & Developers. It's quick & easy.

play a midi file from the interpreter?

P: n/a
(How) can you make it so that a function invoked in the python interpreter can
run another program? (Like the webbrowser module does, only not with a web
browser.) If it matters the OS is Windows98 and the specific aim in mind is to
have a function that saves some data as a midi file and then causes the said
midi file to play.
Jul 18 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Elaine Jackson wrote:
(How) can you make it so that a function invoked in the python interpreter can
run another program? (Like the webbrowser module does, only not with a web
browser.) If it matters the OS is Windows98 and the specific aim in mind is to
have a function that saves some data as a midi file and then causes the said
midi file to play.

Use the popen() call in the os module.

regards Max M
Jul 18 '05 #2

P: n/a
Could you sketch me a useage example? I'm finding the documentation extremely
sparse. I've heard of 'pipes', but I don't actually know what they are.

"Max M" <ma**@mxm.dk> wrote in message news:41************@mxm.dk...
| Elaine Jackson wrote:
| > (How) can you make it so that a function invoked in the python interpreter
can
| > run another program? (Like the webbrowser module does, only not with a web
| > browser.) If it matters the OS is Windows98 and the specific aim in mind is
to
| > have a function that saves some data as a midi file and then causes the said
| > midi file to play.
|
|
| Use the popen() call in the os module.
|
| regards Max M
Jul 18 '05 #3

P: n/a
Elaine Jackson wrote:
Could you sketch me a useage example? I'm finding the documentation extremely
sparse. I've heard of 'pipes', but I don't actually know what they are.


Basically you just pass popen a string that looks like one typed at the
command prompt:

# untested
# (Eg. I don't know the name of your midi file player
# so I call it playmidifile.exe)

import os
midifilename = 'c:/path/to/midifile.mid'
result = os.popen('playmidifile.exe %s' % midifilename)
print result
Jul 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.