def showImage(filename): osName = platform.system() if osName == 'Windows': subprocess.Popen([filename], shell=True) elif osName == 'Linux': if HasCommand('gvfs-open'): subprocess.Popen(['gvfs-open', filename]) elif HasCommand('shotwell'): subprocess.Popen(['shotwell', filename]) else: raise elif osName == 'Darwin': # by @Naville subprocess.Popen(['open', filename]) else: raise Exception('other system')
def showImage(filename): osName = platform.system() if osName == 'Windows': if not PY3: filename = filename.decode('utf8').encode('cp936') subprocess.Popen([filename], shell=True) elif osName == 'Linux': if HasCommand('gvfs-open'): subprocess.Popen(['gvfs-open', filename]) elif HasCommand('shotwell'): subprocess.Popen(['shotwell', filename]) else: raise elif osName == 'Darwin': # by @Naville subprocess.Popen(['open', filename]) else: raise