[Qgis-user] Open in default browser action

Michael Toews mwtoews at sfu.ca
Sun Mar 29 12:20:26 PDT 2009


Hi,
I have a useful python script that opens the default browser and does a search. This is similar to p.43 of the QGIS 1.0 manual, but it doesn't make assumptions of the default browser and it will actually search fields with more than one word (i.e., spaces between) and fields with funny characters, like '!$? etc.

googleit.py:
----
import sys
import urllib
import webbrowser
webbrowser.open("http://www.google.com/search?q="+urllib.quote_plus(sys.argv[1]))
----

It works great from the shell, e.g.:
> python googleit.py "Duffy's Neighbourhood Pub"


But I have no clue how to get this working with the layer actions in QGIS. What do I call in the action box and where do I put the script? I've tried moving the script into various places, and either calling the script directly or using "python" before, etc.

I'm using a variety of QGIS installs at my workplace (version 0.11 to 1.0.1) on a variety of Windows computers, so I'm not sure if there is a common directory structure for QGIS where I can drop it in or what.

Thanks for any help.

-Mike



More information about the Qgis-user mailing list