running non-python progs from python

F

Fredrik Lundh

Spiffy said:
Meanwhile, Fredo has provided a nice answer that WORKS...
along with an explanation of why my code didn't work.

for the benefit of others, maybe you could tell us why
your code didn't work?

</F>
 
M

Mark

Spiffy said:
In the command window the call to the program with the name of the ..mid
file to be played works just fine. Here is what it looks like....exactly:
C:\Python22>playb Canyon.mid

Here is the code used to call it from Python:
import os
filename = "C:\Python22\Canyon.mid"
os.system("C:\Python22\playb.exe%s"%filename)
...this causes a dos box to appear which promptly hangs and does nothing, at
which time Python stops responding. Vartiations on this will cause the dos
box to appear with the message "Bad command or file name".

Try:
import.os
os.system(r"C:\Python22\playb.exe %s"%filename)

or:
import os
os.system("C:\\Python22\\playb.exe %s"%filename)

-Mark
 
S

Spiffy

or:
import os
os.system("C:\\Python22\\playb.exe %s"%filename)

Thank you. Fedor had emailed me yesterday with this solution and a nice
explanation. Thanks to all who tried to help.
 
C

Cameron Laird

Thank you. Fedor had emailed me yesterday with this solution and a nice
explanation. Thanks to all who tried to help.

Did anyone ever disclose the solution publicly? This
case has me curious; os.system() misunderstandings
often arise, and I'd like to learn more about what can
go wrong.
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top