[GRASS-SVN] r53510 - grass/trunk/lib/python/temporal
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Oct 19 15:07:01 PDT 2012
Author: huhabla
Date: 2012-10-19 15:07:01 -0700 (Fri, 19 Oct 2012)
New Revision: 53510
Modified:
grass/trunk/lib/python/temporal/core.py
Log:
Check for sqlite3 Python module added.
Modified: grass/trunk/lib/python/temporal/core.py
===================================================================
--- grass/trunk/lib/python/temporal/core.py 2012-10-19 16:04:01 UTC (rev 53509)
+++ grass/trunk/lib/python/temporal/core.py 2012-10-19 22:07:01 UTC (rev 53510)
@@ -13,7 +13,7 @@
>>> import grass.temporal as tgis
>>> # Create the temporal database
->>> tgis.create_temporal_database()
+>>> tgis.init()
>>> # Establish a database connection
>>> dbif, connected = tgis.init_dbif(None)
>>> dbif.connect()
@@ -39,10 +39,11 @@
import sys
import grass.script.core as core
# Import all supported database backends
+# Ignore import errors sicne they are checked later
try:
import sqlite3
except ImportError:
- raise
+ pass
# Postgresql is optional, existence is checked when needed
try:
import psycopg2
@@ -135,7 +136,6 @@
# We need to set the correct database backend from the environment variables
global tgis_backed
- dbmi = sqlite3
core.run_command("t.connect", flags="c")
kv = core.parse_command("t.connect", flags="pg")
@@ -143,6 +143,12 @@
if "driver" in kv:
if kv["driver"] == "sqlite":
tgis_backed = kv["driver"]
+ try:
+ import sqlite3
+ except ImportError:
+ core.error("Unable to locate the sqlite SQL Python interface module sqlite3.")
+ raise
+ dbmi = sqlite3
elif kv["driver"] == "pg":
tgis_backed = kv["driver"]
try:
@@ -154,6 +160,7 @@
else:
core.fatal(_("Unable to initialize the temporal DBMI interface. Use "
"t.connect to specify the driver and the database string"))
+ dbmi = sqlite3
else:
# Set the default sqlite3 connection in case nothing was defined
core.run_command("t.connect", flags="d")
More information about the grass-commit
mailing list