Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss
Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Dispatching default application for file, cross platform.

0 views
Skip to first unread message

Hendrik van Rooyen

unread,
Aug 22, 2007, 3:26:06 AM8/22/07
to pytho...@python.org
How do I do the equivalent of clicking (in SuSe) or double clicking (in Windows)
on a file?

In effect I want to tell the OS - take this file and feed it to the application
that is registered for it.

Not too sure what to Google for.

- Hendrik


Tim Golden

unread,
Aug 22, 2007, 5:18:30 AM8/22/07
to pytho...@python.org

os.startfile

TJG

Peter Otten

unread,
Aug 22, 2007, 6:04:28 AM8/22/07
to
Tim Golden wrote:

> Hendrik van Rooyen wrote:
>> How do I do the equivalent of clicking (in SuSe) or double clicking (in
>> Windows) on a file?
>>
>> In effect I want to tell the OS - take this file and feed it to the
>> application that is registered for it.

> os.startfile

Unfortunately this is Windows-only.
For KDE you can use

$ kfmclient exec yourfile

Peter

Tim Golden

unread,
Aug 22, 2007, 6:52:38 AM8/22/07
to pytho...@python.org
Peter Otten wrote:
> Tim Golden wrote:
>
>> Hendrik van Rooyen wrote:
>>> How do I do the equivalent of clicking (in SuSe) or double clicking (in
>>> Windows) on a file?
>>>
>>> In effect I want to tell the OS - take this file and feed it to the
>>> application that is registered for it.
>
>> os.startfile
>
> Unfortunately this is Windows-only.

Good point. I think that Paul Boddie's desktop
module is designed to handle cross-platform issues
for this kind of thing: (Never used it myself)

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

TJG

Tommy Nordgren

unread,
Aug 22, 2007, 7:41:24 AM8/22/07
to Peter Otten, pytho...@python.org

> --
> http://mail.python.org/mailman/listinfo/python-list
On Mac OS X, invoke the command /usr/bin/open -a <Application>
file , or /usr/bin/open file
------
What is a woman that you forsake her, and the hearth fire and the
home acre,
to go with the old grey Widow Maker. --Kipling, harp song of the
Dane women
Tommy Nordgren
tommy.n...@comhem.se

Hendrik van Rooyen

unread,
Aug 22, 2007, 11:01:44 AM8/22/07
to Tim Golden, pytho...@python.org
"Tim Golden" <ma...@timgolden.me.uk> wrote:

> Hendrik van Rooyen wrote:
> > How do I do the equivalent of clicking (in SuSe) or double clicking (in
Windows)
> > on a file?
> >
> > In effect I want to tell the OS - take this file and feed it to the
application
> > that is registered for it.
> >

> > Not too sure what to Google for.
> >
> > - Hendrik
>
> os.startfile
>
> TJG

Brill - thanks Tim!

- Hendrik


Hendrik van Rooyen

unread,
Aug 22, 2007, 11:01:16 AM8/22/07
to Tommy Nordgren, Peter Otten, pytho...@python.org
"Tommy Nordgren" <tommy.n...@comhem.se> wrote:


>
> On 22 aug 2007, at 12.04, Peter Otten wrote:
>

> > --
> > http://mail.python.org/mailman/listinfo/python-list
> On Mac OS X, invoke the command /usr/bin/open -a <Application>
> file , or /usr/bin/open file

Thanks Tommy - was not thinking of Macs, but nice to know...

- Hendrik


Hendrik van Rooyen

unread,
Aug 22, 2007, 11:02:23 AM8/22/07
to pytho...@python.org
"Tim Golden" <ma....me.uk>

> Peter Otten wrote:
> > Tim Golden wrote:
> >
> >> Hendrik van Rooyen wrote:
> >>> How do I do the equivalent of clicking (in SuSe) or double clicking (in
> >>> Windows) on a file?
> >>>
> >>> In effect I want to tell the OS - take this file and feed it to the
> >>> application that is registered for it.
> >
> >> os.startfile
> >
> > Unfortunately this is Windows-only.
>

> Good point. I think that Paul Boddie's desktop
> module is designed to handle cross-platform issues
> for this kind of thing: (Never used it myself)
>
> http://pypi.python.org/pypi/desktop/0.2.3
>
> TJG

It gets better and better - Thanks Peter and Tim.

- Hendrik


0 new messages