[GRASS-user] running a simple python script on windows
Ivan Marchesini
ivan.marchesini at gmail.com
Wed Apr 15 23:20:32 PDT 2020
Dear Grass friends,
I prepared a simple python3 script that runs correctly using Grass 7.8
on GNU/Linux.
I put the module in the script folder of /usr/lib/grass78. The parser
is able to open the interface and the module runs.
Someone asked me to run the same script using Grass on Windows (the
standalone version 7.8).
I put the script on the "C:\Program Files\GRASS GIS 7.8\scripts" folder.
When I run a the script, even only with the --help option
(mySimpleGrassScript --help) from the Layer Manager Console, i get the
error listed at the end of this e-mail.
May I kindly ask your help to understand what I have to check or to
modify in order to run the code on window ?
thank you very much
Ivan
The error I get:
______________________
Traceback (most recent call last):
File "C:\Program Files\GRASS GIS
7.8\etc\python\grass\script\task.py", line 474, in
get_interface_description
stderr=PIPE)
File "C:\Program Files\GRASS GIS
7.8\etc\python\grass\script\core.py", line 57, in __init__
.format(args[0]))
OSError
:
Cannot find the executable mySimpleGrassScript
During handling of the above exception, another exception
occurred:
Traceback (most recent call last):
File "C:\Program Files\GRASS GIS
7.8\gui\wxpython\gui_core\forms.py", line 2866, in
ParseCommand
blackList=_blackList)
File "C:\Program Files\GRASS GIS
7.8\etc\python\grass\script\task.py", line 522, in
parse_interface
tree = etree.fromstring(get_interface_description(name))
File "C:\Program Files\GRASS GIS
7.8\etc\python\grass\script\task.py", line 502, in
get_interface_description
"\n\nDetails: <{det}>").format(cmd=cmd, det=e))
grass.exceptions
.
ScriptError
:
Unable to fetch interface description for command
'<mySimpleGrassScript>'.
Details: <Cannot find the executable
mySimpleGrassScript>
During handling of the above exception, another exception
occurred:
Traceback (most recent call last):
File "C:\Program Files\GRASS GIS
7.8\gui\wxpython\core\gconsole.py", line 493, in RunCmd
task = GUI(show=None).ParseCommand(command)
File "C:\Program Files\GRASS GIS
7.8\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
'<mySimpleGrassScript>'.
Details: <Cannot find the executable
mySimpleGrassScript>
During handling of the above exception, another exception
occurred:
Traceback (most recent call last):
File "C:\Program Files\GRASS GIS
7.8\gui\wxpython\gui_core\prompt.py", line 413, in
OnKeyPressed
self._runCmd(self.GetCurLine()[0].strip())
File "C:\Program Files\GRASS GIS
7.8\gui\wxpython\gui_core\prompt.py", line 120, in _runCmd
self.promptRunCmd.emit(cmd=cmd)
File "C:\Program Files\GRASS GIS
7.8\etc\python\grass\pydispatch\signal.py", line 229, in
emit
dispatcher.send(signal=self, *args, **kwargs)
File "C:\Program Files\GRASS GIS
7.8\etc\python\grass\pydispatch\dispatcher.py", line 349, in
send
**named
File "C:\Program Files\GRASS GIS
7.8\etc\python\grass\pydispatch\robustapply.py", line 60, in
robustApply
return receiver(*arguments, **named)
File "C:\Program Files\GRASS GIS
7.8\gui\wxpython\gui_core\goutput.py", line 120, in <lambda>
self._gconsole.RunCmd(command=cmd))
File "C:\Program Files\GRASS GIS
7.8\gui\wxpython\core\gconsole.py", line 496, in RunCmd
message=unicode(e),
NameError
:
name 'unicode' is not defined
More information about the grass-user
mailing list