Opened 5 years ago
Last modified 5 years ago
#4017 new defect
run addon failed > name 'unicode' is not defined
Reported by: | 1266 | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | 7.8.3 |
Component: | wxGUI | Version: | git-releasebranch78 |
Keywords: | python3 | Cc: | |
CPU: | x86-64 | Platform: | Linux |
Description (last modified by )
After installing grass 7.8.3 on debian buster my python2 scripts does not work anymore. Error message :
Traceback (most recent call last): File "/usr/local/grass78/gui/wxpython/gui_core/forms.py", line 2866, in ParseCommand blackList=_blackList) File "/usr/local/grass78/etc/python/grass/script/task.py", line 522, in parse_interface tree = etree.fromstring(get_interface_description(name)) File "/usr/local/grass78/etc/python/grass/script/task.py", line 498, in get_interface_description "\n\nDetails: <{det}>").format(cmd=cmd, det=decode(cmderr))) grass.exceptions . ScriptError : Unable to fetch interface description for command '<r.wtg.visibility>'. Details: <Traceback (most recent call last): File "/home/frank/.grass7/addons/scripts/r.wtg.visibility", line 299, in <module> from grass.pygrass.utils import set_path File "/usr/local/grass78/etc/python/grass/pygrass/utils.py", line 7, in <module> import grass.lib.gis as libgis File "/usr/local/grass78/etc/python/grass/lib/gis.py", line 4 SyntaxError: Non-ASCII character '\xc3' in file /usr/local/grass78/etc/python/grass/lib/gis.py on line 5, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details > During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/grass78/gui/wxpython/core/gconsole.py", line 493, in RunCmd task = GUI(show=None).ParseCommand(command) File "/usr/local/grass78/gui/wxpython/gui_core/forms.py", line 2868, in ParseCommand raise gcmd.GException(e.value) core.gcmd . GException : Unable to fetch interface description for command '<r.wtg.visibility>'. Details: <Traceback (most recent call last): File "/home/frank/.grass7/addons/scripts/r.wtg.visibility", line 299, in <module> from grass.pygrass.utils import set_path File "/usr/local/grass78/etc/python/grass/pygrass/utils.py", line 7, in <module> import grass.lib.gis as libgis File "/usr/local/grass78/etc/python/grass/lib/gis.py", line 4 SyntaxError: Non-ASCII character '\xc3' in file /usr/local/grass78/etc/python/grass/lib/gis.py on line 5, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details > During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/grass78/gui/wxpython/gui_core/prompt.py", line 413, in OnKeyPressed self._runCmd(self.GetCurLine()[0].strip()) File "/usr/local/grass78/gui/wxpython/gui_core/prompt.py", line 120, in _runCmd self.promptRunCmd.emit(cmd=cmd) File "/usr/local/grass78/etc/python/grass/pydispatch/signal.py", line 229, in emit dispatcher.send(signal=self, *args, **kwargs) File "/usr/local/grass78/etc/python/grass/pydispatch/dispa tcher.py", line 349, in send **named File "/usr/local/grass78/etc/python/grass/pydispatch/robus tapply.py", line 60, in robustApply return receiver(*arguments, **named) File "/usr/local/grass78/gui/wxpython/gui_core/goutput.py", line 120, in <lambda> self._gconsole.RunCmd(command=cmd)) File "/usr/local/grass78/gui/wxpython/core/gconsole.py", line 496, in RunCmd message=unicode(e), NameError : name 'unicode' is not defined
If I add
# -*- coding:UTF-8 -*-
on first line in /usr/local/grass78/etc/python/grass/lib/gis.py and /usr/local/grass78/etc/python/grass/lib/raster.py my scripts seem to work (gui dispalyed)
my LOCAL is LANG=fr_FR.UTF-8
Change History (4)
comment:1 by , 5 years ago
Component: | Default → wxGUI |
---|---|
Description: | modified (diff) |
Keywords: | python3 added |
Milestone: | → 7.8.3 |
comment:2 by , 5 years ago
comment:3 by , 5 years ago
Hello, The french download default folder is "Téléchargements". It's from this folder I have installed grass. Si This string appear in the file numerous time. grep Téléchargements /usr/local/grass78/etc/python/grass/lib/gis.py | wc -l return 696. I will keep -*- coding UTF-8 -*- But for future, it could be useful to take this in account for all language with special characters ? Regards Frank
comment:4 by , 5 years ago
It's probably fine to inject -*- coding UTF-8 -*-
into the ctypesgen generated files but I am surprised that this comes up only now (and we have definitely French language users :-).
Maybe the underlying reason is a different one?
This seems to be a self compiled GRASS install. Please provide a full path to GRASS source directory. My guess — the path to GRASS source contains a non-ascii char (username?) and it is written into the header of gis.py as a comment.
Injecting # -*- coding:UTF-8 -*- by ctypesgen could be a good solution for the issue. Second option would be to strip header comment block completely.