[GRASS-SVN] r74481 - grass/trunk/scripts/v.in.geonames

svn_grass at osgeo.org svn_grass at osgeo.org
Wed May 15 10:37:29 PDT 2019


Author: annakrat
Date: 2019-05-15 10:37:29 -0700 (Wed, 15 May 2019)
New Revision: 74481

Modified:
   grass/trunk/scripts/v.in.geonames/v.in.geonames.py
Log:
v.in.geonames: read as utf8, see #3781

Modified: grass/trunk/scripts/v.in.geonames/v.in.geonames.py
===================================================================
--- grass/trunk/scripts/v.in.geonames/v.in.geonames.py	2019-05-15 16:56:34 UTC (rev 74480)
+++ grass/trunk/scripts/v.in.geonames/v.in.geonames.py	2019-05-15 17:37:29 UTC (rev 74481)
@@ -35,6 +35,9 @@
 #%end
 
 import os
+import sys
+if sys.version_info.major == 2:
+    from io import open
 import grass.script as grass
 
 
@@ -59,8 +62,8 @@
         grass.warning(
             _("Since DBF driver is used, the content of the 'alternatenames' column might be cut with respect to the original Geonames.org column content"))
 
-    with open(infile) as f:
-        num_places = sum(1 for _ in f)
+    with open(infile, encoding='utf-8') as f:
+        num_places = sum(1 for each in f)
     grass.message(_("Converting %d place names...") % num_places)
 
     # pump data into GRASS:



More information about the grass-commit mailing list