OS independent file associate ?

S

Stef Mientki

hello,

I would like to make my programs available under the "standard" OS's,
like Windows, Linux (,Mac)
One of the problems I encounter, is launching of files through their
file associates (probably a windows only terminology ;-)
Now I can detect the OS, but only the main OS and not e.g. Ubuntu /
Gnome or whatever I've to detect.
Through trial and error I found a working mechanism under Ubuntu, but as
I have to specify "gnome", I doubt this will work under other Linux systems.

any good solutions available ?

thanks,
Stef Mientki

import subprocess
CHM = '../numpy.chm'

# works under Ubuntu
subprocess.Popen( "gnome-open " + CHM , shell = True )

# doesn't work under Ubuntu
# (the list should be converted to a number of arguments,
#but that doesn't seem to work under Ubuntu.
subprocess.Popen( [ "gnome-open" , CHM] ,shell = True )

# works under Windows
subprocess.Popen( CHM , shell = True )

# works better under windows
win32help.HtmlHelp ( Win32_Viewer,
str(CHM),
win32help.HH_DISPLAY_INDEX,
str ( keyword ) )
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top