Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] v.rast.bufferstats python 2 vs python 3 issue #274

Closed
hansvancalster opened this issue Sep 15, 2020 · 2 comments · Fixed by #276
Closed

[Bug] v.rast.bufferstats python 2 vs python 3 issue #274

hansvancalster opened this issue Sep 15, 2020 · 2 comments · Fixed by #276

Comments

@hansvancalster
Copy link

v.rast.bufferstats.py

The unicode() python 2 function fails for Python 3. It should be replaced by str() according to this porting guide. After manually replacing unicode with str on line 339 the problem was gone.

To Reproduce

g.region -p raster=elevation,geology_30m
v.clip --o -r input=bridges output=bridges_wake
# Tabulate area of land cover map
g.region -p raster=elevation,geology_30m align=geology_30m
v.rast.bufferstats -t input=bridges_wake raster=geology_30m buffers=100,250,500 column_prefix=geology

Just taking the example from the manual here. Not tested, but expect it will show same error (see screenshot).

Expected behavior
v.rast.bufferstats exits with calculated results

Screenshots
image

System description (please complete the following information):

  • Operating System: Windows 7
  • GRASS GIS version 7.8.3
  • details about further software components
version=7.8.3
date=2020
revision=8bcecc9a6
build_date=2020-05-05
build_platform=x86_64-w64-mingw32
build_off_t_size=8
libgis_revision=8bcecc9a6
libgis_date=2020-05-05T08:51:50+00:00
proj=6.3.2
gdal=3.0.4
geos=3.8.1
sqlite=3.29.0
neteler added a commit that referenced this issue Sep 17, 2020
* minor compile fixes

* unicode() compatibility fix for Python-2/Python-3

Uses compatibility test from

https://github.com/OSGeo/grass/blob/0a5097cd0e53f3df8285a3bef68b43e8050d273e/lib/python/script/core.py#L37

(and many other places in GRASS-core)

Fixes #274
@neteler
Copy link
Member

neteler commented Sep 17, 2020

I have added a unicode() compatibility fix for both Python-2 and Python-3.
Please reopen in case the problem persists.

@hansvancalster
Copy link
Author

Thank you 👍

landam pushed a commit to landam/grass-addons that referenced this issue Nov 19, 2020
* minor compile fixes

* unicode() compatibility fix for Python-2/Python-3

Uses compatibility test from

https://github.com/OSGeo/grass/blob/0a5097cd0e53f3df8285a3bef68b43e8050d273e/lib/python/script/core.py#L37

(and many other places in GRASS-core)

Fixes OSGeo#274
landam pushed a commit to landam/grass-addons that referenced this issue Dec 10, 2020
* minor compile fixes

* unicode() compatibility fix for Python-2/Python-3

Uses compatibility test from

https://github.com/OSGeo/grass/blob/0a5097cd0e53f3df8285a3bef68b43e8050d273e/lib/python/script/core.py#L37

(and many other places in GRASS-core)

Fixes OSGeo#274
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants