python call external program (WHAT THE?!)

Ben Thomas bthomas at trey-industries.com
Thu Sep 16 09:47:44 EDT 1999


I am using Python not VBasic for the expressed purpose of moving off the Windows
platform. I cannot , however, do it too quickly. Please bear with us folks who
are working contracts that specify Windows, we are converting the programs and
peoples attitudes as fast as we can. :)

sorry for the simple question
Ben

Phil Hunt wrote:

> In article <65118AEEFF5AD3118E8300508B124877073BF5 at webmail.altiris.com>
>            MSteed at altiris.com "Mike Steed" writes:
> > > From: Ben Thomas [mailto:bthomas at trey-industries.com]
> > > Sent: Tuesday, September 14, 1999 9:31 AM
> > > To: python-list at python.org
> > > Subject: Re: python call external program (WHAT THE?!)
> > >
> > >
> > > I just tried but putting the batch file in three places on a
> > > drive. The I tried
> > > them all.
> > >
> > > system('d:\mybat.bat') = ok
> > > system('d:\data\mybat.bat') = ok
> > > system('d:\data\vacman\mybat.bat') = fails, it works fine
> > > from DOS prompt!
> > >
> > >
> > > what gives?
> > > Ben
> >
> > What gives is that \v is an escape code (representing, I believe, the ASCII
> > VT character).  There are a few ways around this.
> >
> > # Use raw strings
> > system(r'd:\data\vacman\mybat.bat')
> >
> > # Escape your backslashes
> > system('d:\\data\\vacman\\mybat.bat')
> >
> > # Use forward slashes (at least this works on WinNT)
> > system('d:/data/vacman/mybat.bat')
>
> You missed out:
>
> # use Linux instead of MS rubbish
> system('/usr/local/data/myshell.sh')
>
> --
> Phil Hunt - - - - - - - - -  philh at vision25.demon.co.uk
>  - Linux will be 8 years old on 17th September! See: -
> http://www.vision25.demon.co.uk/prog/linuxbirthday.html





More information about the Python-list mailing list