[GRASS-dev] [GRASS GIS] #4017: run addon failed > name 'unicode' is not defined
GRASS GIS
trac at osgeo.org
Sat Jan 11 11:35:48 PST 2020
#4017: run addon failed > name 'unicode' is not defined
---------------------+---------------------------------
Reporter: 1266 | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 7.8.3
Component: wxGUI | Version: git-releasebranch78
Resolution: | Keywords: python3
CPU: x86-64 | Platform: Linux
---------------------+---------------------------------
Changes (by neteler):
* keywords: => python3
* component: Default => wxGUI
* milestone: => 7.8.3
Old description:
> 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
New description:
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
--
--
Ticket URL: <https://trac.osgeo.org/grass/ticket/4017#comment:1>
GRASS GIS <https://grass.osgeo.org>
More information about the grass-dev
mailing list