Bug report #21269

Python3 error when running GRASS 7.6 tools in processing on mac OS

Added by Alejandro Garcia about 5 years ago. Updated about 5 years ago.

Status:Open
Priority:High
Assignee:William Kyngesburye
Category:Processing/GRASS
Affected QGIS version:3.4.4 Regression?:Yes
Operating System:macOS 10.14.3 Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:29087

Description

The Grass algorithm r.contour in the toolbox does not work and stop with an error message.

qgis 3.4.4 / grass 7.6 / macOS 10.14.3

Log Grass r.contours.rtf (5.36 KB) Alejandro Garcia, 2019-02-14 01:51 PM

Screen Shot 2019-02-13 at 9.11.12 AM_2.png (591 KB) Alejandro Garcia, 2019-02-14 01:51 PM

History

#1 Updated by Giovanni Manghi about 5 years ago

  • Regression? changed from No to Yes
  • Category changed from GRASS to Processing/GRASS
  • Subject changed from GRASS algorithms in processing does not work (qgis 3.4.4 grass 7.6) to python error when running GRASS 7.6 tools in processing on mac OS

Traceback (most recent call last):
File "/Applications/QGIS3.app/Contents/MacOS/grass/grass74", line 2029, in <module>
main()
File "/Applications/QGIS3.app/Contents/MacOS/grass/grass74", line 1880, in main
set_paths(grass_config_dir=grass_config_dir)
File "/Applications/QGIS3.app/Contents/MacOS/grass/grass74", line 622, in set_paths
os.environ['MANPATH'] = sys_man_path
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/os.py", line 674, in setitem
value = self.encodevalue(value)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/os.py", line 744, in encode
raise TypeError("str expected, not %s" % type(value).__name__)
TypeError: str expected, not bytes
WARNING: Default locale settings are missing. GRASS running with C locale.
Default locale not found, using UTF-8
Traceback (most recent call last):
File "/Applications/QGIS3.app/Contents/MacOS/grass/grass74", line 2029, in <module>
main()
File "/Applications/QGIS3.app/Contents/MacOS/grass/grass74", line 1880, in main
set_paths(grass_config_dir=grass_config_dir)
File "/Applications/QGIS3.app/Contents/MacOS/grass/grass74", line 622, in set_paths
os.environ['MANPATH'] = sys_man_path
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/os.py", line 674, in setitem
value = self.encodevalue(value)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/os.py", line 744, in encode
raise TypeError("str expected, not %s" % type(value).__name__)
TypeError: str expected, not bytes
Execution completed in 2.52 seconds
Results: {'output': <QgsProcessingOutputLayerDefinition {'sink':/contours_alaska.shp, 'createOptions': {'fileEncoding': 'System'}}>}

Loading resulting layers
The following layers were not correctly generated.<ul><li>/contours_alaska.shp</li></ul>You can check the 'Log Messages Panel' in QGIS main window to find more information about the execution of the algorithm.

#2 Updated by Peter Petrik about 5 years ago

  • Assignee set to William Kyngesburye

The issue is caused by grass76 bug in retrieving MANPATH directly by calling `manpath` command in submodule. This should be probably fixed in next GRASS release (fully compatible with python3).
As a workaround it should be enough to set environment variable
`export MANPATH=/usr/local/share/man:/usr/share/man` in QGIS startup script or environment.

The bug is not present in unofficial all-in-one MacOS packages https://lutraconsulting.github.io/qgis-mac-packager/ as the workaround was applied in https://github.com/lutraconsulting/qgis-mac-packager/issues/50

#3 Updated by Peter Petrik about 5 years ago

  • Subject changed from python error when running GRASS 7.6 tools in processing on mac OS to Python3 error when running GRASS 7.6 tools in processing on mac OS

#4 Updated by William Kyngesburye about 5 years ago

I'm not sure what your workaround is, I couldn't find anything in that mac packager issue. I think I'll try patching my bundled grass74 to set the MANPATH. I won't be able to test it - I don't have macOS Mojave, and I don't have this problem on Sierra.

Also available in: Atom PDF