running non-python progs from python

Spiffy spiffy at
Tue Dec 9 23:06:32 CET 2003

"Dennis Lee Bieber" <wlfraed at> wrote in message
news:ef9ha1-6p3.ln1 at
> 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/
> -- 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
> 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"
...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".

============================================================== <
>  >   wlfraed at  | Wulfraed  Dennis Lee Bieber  KD6MOG <
>  >      wulfraed at     |       Bestiaria Support Staff       <
>  > ============================================================== <
>  >        Bestiaria Home Page:         <
>  >            Home Page:             <

More information about the Python-list mailing list