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
Wed Dec 16 11:03:31 EST 2009


#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.

import os
import subprocess

def startfile(filename)
  try:
     os.startfile(filename)
  except:
     subprocess.Popen(['xdg-open', filename])


_______________________________
http://dextracker.blogspot.com/



More information about the Python-list mailing list