Skip to content

Commit

Permalink
g.proj.identify: lazy import of osgeo library
Browse files Browse the repository at this point in the history
fixed #302
  • Loading branch information
lucadelu committed Nov 19, 2020
1 parent 59d82f2 commit 03a2b1e
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions grass7/general/g.proj.identify/g.proj.identify.py
Expand Up @@ -54,17 +54,6 @@
from grass.script import core as grass
from grass.pygrass.modules import Module

try:
from osgeo import osr
except ImportError:
grass.fatal(
_(
"Unable to load GDAL Python bindings (requires package "
"'python-gdal' being installed)"
),
)


def writeEPSGtoPEMANENT(epsg):
env = grass.gisenv()
gisdbase = env['GISDBASE']
Expand Down Expand Up @@ -153,6 +142,12 @@ def epsg2standards(epsg):
print('proj4=%s' % srs.ExportToProj4())

def main():
try:
from osgeo import osr
except ImportError:
grass.fatal(_("Unable to load GDAL Python bindings (requires package "
"'python-gdal' being installed)"),)

epsg=options['epsg']
pathwkt=options['wkt']
if epsg and pathwkt:
Expand Down

0 comments on commit 03a2b1e

Please sign in to comment.