import os
import subprocess
def startfile(filename)
try:
os.startfile(filename)
except:
subprocess.Popen(['xdg-open', filename])
_______________________________
http://dextracker.blogspot.com/
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