I have a cross platform os.startfile but I need to asociate files with xdg-open in linux how do I do that??

Eric_Dexter at msn.com Eric_Dexter at msn.com
Thu Dec 17 15:21:42 EST 2009


On Dec 16, 3:02 pm, "Eric_Dex... at msn.com" <Eric_Dex... at msn.com> wrote:
> On Dec 16, 10:36 am, Paul Boddie <p... at boddie.org.uk> wrote:
>
>
>
> > On 16 Des, 17:03, "Eric_Dex... at msn.com" <Eric_Dex... at msn.com> wrote:
>
> > > #this should be a cross platform example of os.startfile ( startfile )
> > > #for windows and linux.  this is the first version and
> > > #linux, mac, other os's commands for exceptions to the
> > > #rule would be appreciated.  at some point this will be
> > > #in the dex tracker project.
>
> > You could look at the desktop package for something similar:
>
> >http://pypi.python.org/pypi/desktop
>
> > The desktop.open function supports a few extra workarounds, mostly
> > because it pre-dates xdg-open.
>
> > Paul
>
> "Since desktop environments like KDE and GNOME provide mechanisms for
> running
> browsers and editors according to the identified type of a file or
> resource,
> just as Windows "runs" files or resources, it is appropriate to have a
> module
> which accesses these mechanisms. It is this kind of functionality that
> the
> desktop package aims to support. Note that this approach is arguably
> better"
>
> I am concerned this means I cant do something like associate python
> files with python in artistx (ubuntu).  It just associates text files
> with editors??  It does look like a cool package and I will look into
> that further.

I suppose I could test the extension..  if '.py' in filename and then
default to xdg-open if it isn't seems realy messy though.

______________________________
http://dextracker.blogspot.com



More information about the Python-list mailing list