Google 网上论坛不再支持新的 Usenet 帖子或订阅项。历史内容仍可供查看。

Dispatching default application for file, cross platform.

已查看 0 次
跳至第一个未读帖子

Hendrik van Rooyen

未读,
2007年8月22日 03:26:062007/8/22
收件人 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

未读,
2007年8月22日 05:18:302007/8/22
收件人 pytho...@python.org

os.startfile

TJG

Peter Otten

未读,
2007年8月22日 06:04:282007/8/22
收件人
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

未读,
2007年8月22日 06:52:382007/8/22
收件人 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

未读,
2007年8月22日 07:41:242007/8/22
收件人 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

未读,
2007年8月22日 11:01:442007/8/22
收件人 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

未读,
2007年8月22日 11:01:162007/8/22
收件人 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

未读,
2007年8月22日 11:02:232007/8/22
收件人 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 个新帖子