Open file in default app and exit in Windows

stephen.boulet at gmail.com stephen.boulet at gmail.com
Wed Jan 28 17:14:26 CET 2015


On Wednesday, January 28, 2015 at 10:07:25 AM UTC-6, Tim Golden wrote:
> On 28/01/2015 15:50, stephen... at gmail.com wrote wrote:
> > I am using the following to open a file in its default application in
> > Windows 7:
> > 
> > from subprocess import call
> > 
> > filename = 'my file.csv' call('"%s"' % filename, shell=True)
> > 
> > This still leaves a python process hanging around until the launched
> > app is closed. Any idea how to get around?
> > 
> 
> This is somewhat clumsy. The built-in way is:
> 
> import os
> os.startfile("my file.csv")
> 
> TJG

Thank you. That is what I was looking for.



More information about the Python-list mailing list