Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • grass-addons/grass7/vector/v.in.natura2000/v.in.natura2000.py

    r66995 r67009  
    118118import tempfile
    119119import grass.script as grass
    120 try:
    121     import pyspatialite.dbapi2 as db
    122 except ImportError:
    123     grass.warning( "pyspatialite has to be installed." )
    124120
    125121if not os.environ.has_key("GISBASE"):
     
    152148    list_site_type = flags['t']
    153149    global tmp   
    154  
     150
     151    try:
     152                import pyspatialite.dbapi2 as db
     153    except:
     154                grass.fatal( "pyspatialite is needed to run this script.\n"
     155                                     "source: https://pypi.python.org/pypi/pyspatialite \n"
     156                                     "Please activate/install it in your python stack.")       
     157
    155158    if list_n2k_layer :
    156159        grass.message( "Available data layer(s):" )
     
    180183        conn = db.connect("%s" % n2k_input)
    181184        c = conn.cursor()
    182         for row in c.execute('SELECT HABITATCODE, DESCRIPTION FROM HABITATS GROUP BY HABITATCODE'):     
    183                 grass.message( row )
     185        try:
     186            for row in c.execute('SELECT HABITATCODE, DESCRIPTION FROM HABITATS GROUP BY HABITATCODE'):
     187                    grass.message( row )
     188        except:
     189            pass
     190            grass.warning("Some problems querying habitat code or names occurred."
     191                          " Please check columns HABITATCODE and DESCRIPTION of table HABITATS in the sqlite database.")
    184192        conn.close()
    185193
     
    188196        conn = db.connect("%s" % n2k_input)
    189197        c = conn.cursor()
    190         for row in c.execute('SELECT SPECIESCODE, SPECIESNAME FROM SPECIES GROUP BY SPECIESCODE'):     
    191                 grass.message( row )
     198        try:
     199            for row in c.execute('SELECT SPECIESCODE, SPECIESNAME FROM SPECIES GROUP BY SPECIESCODE'): 
     200                    grass.message( row )
     201        except:
     202            pass
     203            grass.warning("Some problems querying species code or names occurred."
     204                          " Please check columns SPECIESCODE and SPECIESNAME of table SPECIES in the sqlite database.")
    192205        conn.close()
    193206
Note: See TracChangeset for help on using the changeset viewer.