running non-python progs from python
Mark
nospam at nospam.com
Thu Dec 11 10:56:33 EST 2003
"Spiffy" <spiffy at worldnet.att.net> wrote in message
news:IHrBb.172631$Ec1.6601048 at bgtnsc05-news.ops.worldnet.att.net...
>
> "Dennis Lee Bieber" <wlfraed at ix.netcom.com> wrote in message
> news:ef9ha1-6p3.ln1 at beastie.ix.netcom.com...
> > Spiffy fed this fish to the penguins on Tuesday 09 December 2003 00:38
> > am:
> >
> > > from the "Learning Python" book. When I run it, the dos command line
> > > appears with the message 'Bad command or file name". Both the .exe and
> > > the .mid file are in the python path and the spelling has been
> > > checked. What I expected to happen was that the os.system call would
> > > start the .exe and begin playing the .mid file. This does not happen.
> > > This is what I meant when I said I haven't been able to get this to
> > > work.
> > >
> > So include (don't retype or paraphrase, use cut&paste) the
/exact/
> > code which is failing, AND the exact command window output...
> >
> > Among other things, I don't think os.system() uses the /Python/
> path
> > -- its the equivalent of opening a new command prompt and typing the
> > command; so it is the OS search path that is used.
> >
> > Open a command window, and type the exact command you think you
> are
> > using in os.system()
> >
> > --
> > >
> 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
>
> ============================================================== <
> > > wlfraed at ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG <
> > > wulfraed at dm.net | Bestiaria Support Staff <
> > > ============================================================== <
> > > Bestiaria Home Page: http://www.beastie.dm.net/ <
> > > Home Page: http://www.dm.net/~wulfraed/ <
> >
>
>
More information about the Python-list
mailing list