[GRASS-dev] [GRASS GIS] #3392: t.register: encoding error
GRASS GIS
trac at osgeo.org
Thu Aug 17 05:12:50 PDT 2017
#3392: t.register: encoding error
--------------------------+---------------------------------
Reporter: mlennert | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 7.2.2
Component: Temporal | Version: svn-trunk
Resolution: | Keywords: t.register encoding
CPU: Unspecified | Platform: Unspecified
--------------------------+---------------------------------
Comment (by mlennert):
Replying to [comment:12 annakrat]:
> The problem mostly comes from calling gisenv function from script.utils
which returns unicode. This was done some time ago to make the library
Python3 compatible. So we eventually need to move towards unicode, but to
have a quick fix for the release, we can keep the temporal library using
bytestrings. This is a possible solution:
>
>
> {{{
> Index: lib/python/temporal/core.py
> ===================================================================
> --- lib/python/temporal/core.py (revision 71395)
> +++ lib/python/temporal/core.py (working copy)
> @@ -542,9 +542,9 @@
> grassenv = gscript.gisenv()
>
> # Set the global variable for faster access
> - current_mapset = grassenv["MAPSET"]
> - current_location = grassenv["LOCATION_NAME"]
> - current_gisdbase = grassenv["GISDBASE"]
> + current_mapset = gscript.encode(grassenv["MAPSET"])
> + current_location = gscript.encode(grassenv["LOCATION_NAME"])
> + current_gisdbase = gscript.encode(grassenv["GISDBASE"])
>
> # Check environment variable GRASS_TGIS_RAISE_ON_ERROR
> if os.getenv("GRASS_TGIS_RAISE_ON_ERROR") == "True" or \
> @@ -1107,6 +1107,7 @@
> detect_types=self.dbmi.PARSE_DECLTYPES |
self.dbmi.PARSE_COLNAMES)
> self.connection.row_factory = self.dbmi.Row
> self.connection.isolation_level = None
> + self.connection.text_factory = str
> self.cursor = self.connection.cursor()
> self.cursor.execute("PRAGMA synchronous = OFF")
> self.cursor.execute("PRAGMA journal_mode = MEMORY")
>
> }}}
>
Can we apply this patch to trunk ? And could we even apply this to
release72 to get it into 7.2.2, or is it too risky ?
--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3392#comment:17>
GRASS GIS <https://grass.osgeo.org>
More information about the grass-dev
mailing list