0

strong text I want to open the file in web browser in different platforms, I did for #Mac and #linux, but my problem is I do not know for windows. Here my code:

f = open(orginal_filename, "r")
if os.name == "darwin": #Mac
       sp.Popen(["open", orginal_filename]) 
elif  os.name=='posix': #linux
       sp.Popen(["firefox", orginal_filename])
elif  os.name=="nt":     #win
       sp.Popen(["?????", orginal_filename])
Fatimah
  • 1
  • 2
  • checkout this question http://stackoverflow.com/questions/281888/open-explorer-on-a-file – Mazdak Apr 16 '15 at 07:35
  • In windows it is not working because the folder which contains executable is not in your `PATH` variable. – Ashwani Apr 16 '15 at 07:42
  • it did not solve my problem, it just open the current folder of my code based on following code:import subprocess subprocess.Popen(r'explorer /select,"C:\path\of\folder\file"') – Fatimah Apr 16 '15 at 08:27

0 Answers0