run-mailcap in python?

Thomas Guettler zopestoller at thomas-guettler.de
Tue Sep 10 09:34:55 EDT 2002


Peter Hansen schrieb:
> 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

Yes, ugly but it works. Thank you!

  thomas




More information about the Python-list mailing list