Python webbrowser - Check if browser is available (nothing happens when opening webpage over an SSH connection) -


is there way detect whether there browser available on system on script run? nothing happens when running following code on server:

try:     webbrowser.open("file://" + os.path.realpath(path)) except webbrowser.error:     print "something went wrong when opening webbrowser" 

it's weird there's no caught exception, , no open browser. i'm running script command line on ssh-connection, , i'm not proficient in server-related stuff, there may way of detecting missing.

thanks!

checkout documentation:

webbrowser.get([name])

return controller object browser type name. if name empty, return controller default browser appropriate caller’s environment.

this works me:

try:     # not interested in return value     webbrowser.get()     webbrowser.open("file://" + os.path.realpath(path)) except exception e:     print "webbrowser error: " % e 

output:

webbrowser error: not locate runnable browser 

Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

mapreduce - Resource manager does not transit to active state from standby -

serialization - Convert Any type in scala to Array[Byte] and back -