problems with opening files due to file's path

Mike Driscoll kyosohma at
Tue Jun 10 20:50:29 CEST 2008

On Jun 10, 1:25 pm, "Thomas Morton" <morton.tho... at>
> maybe try string substitution... not sure if that's really the BEST way to
> do it but it should work
> startfile(r"%s"%variable)

I concur. That should work. A slightly more in depth example (assuming

os.startfile(r'C:\Documents and Settings\%s\Desktop\myApp.exe' %


os.startfile(r'C:\Program Files\%s' % myApp)

Hopefully this is what you are talking about. If you were referring to
passing in arguments, than you'll want to use the subprocess module

> --------------------------------------------------
> From: "Alexnb" <alexnbr... at>
> Sent: Tuesday, June 10, 2008 7:05 PM
> To: <python-l... at>
> Subject: Re: problems with opening files due to file's path
> > Well, now i've hit another problem, this time being that the path will be
> > a
> > variable, and I can't figure out how to make startfile() make it raw with
> > a
> > variable, if I put startfile(r variable), it doesn't work and
> > startfile(rvariable) obviously won't work, do you know how to make that
> > work
> > or better yet, how to take a regular string that is given and make every
> > single "\" into a double "\\"?



More information about the Python-list mailing list