[QGIS-Developer] Show Location in Google Earth - Mac / Linux Users Input Requested

Richard Duivenvoorde rdmailings at duif.net
Mon Mar 11 11:56:55 PDT 2019


On 11/03/2019 15.04, C Hamilton wrote:
> I've had a request for Lat Lon Tools to support Google Earth with its
> "Show in External Map" tool. I could create a temporary KML file and
> make one of the following calls.
> 
> os.startfile('path to kml file')
> webbrowser.open('path to kml file')
> 
> For the Linux and Mac users, do these work and which is preferable? They
> both work on Windows.

Hi C,
not sure how to test this but I (Debian) created a simple kml file in
/tmp/test.kml and then tried your calls:

import os
os.startfile('/tmp/test.kml')
Traceback (most recent call last):
  File "/usr/lib/python3.7/code.py", line 90, in runcode
    exec(code, self.locals)
  File "<input>", line 1, in <module>
AttributeError: module 'os' has no attribute 'startfile'

import webbrowser
webbrowser.open('/tmp/test.kml')
True

Opens this test.kml but off course trying to open it in browser

HTH & regards

Richard Duivenvoorde


More information about the QGIS-Developer mailing list