<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="NO-BOK" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Dear Camille,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US">I don`t get that error in GRASS 7.8.3 with your example.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US">Can you post the exact command (if it was different from your example), and GRASS version as well as OS?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US">Addons need to be on your PATH / ADDON_PATH.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US">Cheers<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US">Stefan<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> grass-user <grass-user-bounces@lists.osgeo.org>
<b>On Behalf Of </b>Cam Morlus<br>
<b>Sent:</b> fredag 15. januar 2021 11:37<br>
<b>To:</b> grass-user@lists.osgeo.org<br>
<b>Subject:</b> [GRASS-user] Can't use simple GRASS modules in python when not using ".py" in module call<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Dear All, <o:p></o:p></p>
<div>
<p class="MsoNormal"><br>
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:<br>
<span style="color:#666666;background:#EEEEEE"><br>
import grass.script as gscript<br>
gscript.run_command("v.db.dropcolumn", flags="help")</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><br>
It raises the error:<br>
<span style="color:#666666;background:#EEEEEE"><br>
grass.exceptions.CalledModuleError: Module run None v.db.dropcolumn --help ended with error.<br>
Process ended with non-zero return code 9009</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">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:<br>
<br>
<span style="color:#666666;background:#EEEEEE">gscript.run_command("<a href="https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fv.db.dropcolumn.py%2F&data=04%7C01%7C%7C6777bf389f194dc3954a08d8b941928a%7C6cef373021314901831055b3abf02c73%7C0%7C0%7C637463038877120044%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=ra6Nu%2FwP%2BDmHIPxzKtlzwo%2FzLJuve01OwcqqXQweW7k%3D&reserved=0">v.db.dropcolumn.py</a>",
 flags="help")</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">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("<a href="https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fv.db.dropcolumn.py%2F&data=04%7C01%7C%7C6777bf389f194dc3954a08d8b941928a%7C6cef373021314901831055b3abf02c73%7C0%7C0%7C637463038877120044%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=ra6Nu%2FwP%2BDmHIPxzKtlzwo%2FzLJuve01OwcqqXQweW7k%3D&reserved=0">v.db.dropcolumn.py</a>"). <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Does anybody know how to solve this?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Thank you in advance for the answer, <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Best, <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Camille Morlighem <o:p></o:p></p>
</div>
</div>
</div>
</body>
</html>