Launch file based on association

Paul Boddie paul at boddie.org.uk
Mon Jan 23 11:48:45 EST 2006


Fredrik Lundh wrote:
> Chris Cioffi wrote:
>
> > Q:  If I have a file called "spreadsheet.xls" how can I launch it in what
> > ever program it is associated with?  I don't care if that program is Excel
> > or OpenOffice Calc.  I just want to launch the file.
>
> >>> import os
> >>> help(os.startfile)

[...]

And for a cross-platform experience, try the desktop module:

http://www.python.org/pypi/desktop

It uses os.startfile on Windows, but also provides access to file/URL
opening functionality in KDE, GNOME and Mac OS X. Given a comprehensive
enough selection of software (and a sane configuration), even Excel
files can be opened in Calc using desktop.open.

Paul




More information about the Python-list mailing list