[GRASS-user] Can't use simple GRASS modules in python when not using ".py" in module call
Cam Morlus
cam.morlus at gmail.com
Fri Jan 15 02:37:20 PST 2021
Dear All,
I am using grass 7.8.4. I'm trying to run some simple commands using the
Grass Python Scripting Library in Python. For modules for which the source
code is written in C or any other language than Python, it works without
problem but for the modules written in Python it does not. Here is an
example of a simple command I tried to run:
import grass.script as gscript
gscript.run_command("v.db.dropcolumn", flags="help")
It raises the error:
grass.exceptions.CalledModuleError: Module run None v.db.dropcolumn --help
ended with error.
Process ended with non-zero return code 9009
I already checked and I know that return code 9009 means it does not find
the python script. I solved the error by just adding ".py" in the command:
gscript.run_command("v.db.dropcolumn.py", flags="help")
I would like the command to work without the ".py" because I'm writing a
python script that makes use of some addons. For the addons to work in my
python script I sometimes need to modify them because there are running
commands like "v.db.dropcolumn" without the ".py", so I have to add it. But
then, the addons do not work anymore when I use them directly in the grass
GUI. I tried to use pygrass and it also raises an error if I'm using
Module("v.db.dropcolumn") instead of Module("v.db.dropcolumn.py").
Does anybody know how to solve this?
Thank you in advance for the answer,
Best,
Camille Morlighem
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20210115/94eb38ab/attachment.html>
More information about the grass-user
mailing list