run-mailcap in python?

Peter Hansen peter at engcorp.com
Tue Sep 10 14:31:28 CEST 2002


Thomas Guettler wrote:
> Thomas Guettler schrieb:
> 
>> Hi!
>>
>> On Unix there is a script called run-mailcap, which
>> opens the corresponding programm with the given file:
>>
>> run-mailcap foo.html
>> --> Default browser starts
> 
> 
> [cut]
> 
>> run("foo.html")
>>  --> Browser starts
> 
> 
> I just discoverd os.startfile(), but it is unfortunately
> only available on win32.
> 
> A Unix version would be nice.

import  os
if os.name == 'posix':
     def startfile(name):
         os.system('run-mailcap "%s"' % name)
     os.startfile = startfile

?

-Peter




More information about the Python-list mailing list