os.startfile() on Linux ?
Arne Koewing
ark at gmx.net
Tue Mar 11 07:28:22 EST 2003
"Harald Schneider" <h_schneider at marketmix.com> writes:
> Hi,
>
> is there a way to call a file with it's corresponding application, like
> os.startfile() on Win32 does ?
> E.g. os.startfile('page.html') brings up this document in the default web
> browser.
>
for the browser there is the webbrowser module:
import webbrowser
webbrowser.open('page.html')
that's portable between win/linux/osX ...
if you need support for other files two there is the mailcap module
import mailcap
mailcap.findmatch(mailcap.getcaps(),'text/html')
("/usr/bin/mozilla '/dev/null'", {'test': 'test -n "$DISPLAY"',
'nametemplate': '%s.html', 'description': 'HTML Text', 'view':
"/usr/bin/mozilla '%s'"})
take a look at
http://www.python.org/doc/current/lib/module-mailcap.html
or
http://www.python.org/doc/current/lib/module-webbrowser.html
Arne
More information about the Python-list
mailing list