<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta content="text/html;charset=UTF-8" http-equiv="Content-Type"></head><body ><div style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10pt;"><div><br></div><div><br></div><div class="zmail_extra" data-zbluepencil-ignore="true" style=""><div><br></div><div id="Zm-_Id_-Sgn1">---- Attivato mar, 24 ago 2021 10:10:10 +0200 <b>Stefan Blumentrath <Stefan.Blumentrath@nina.no></b> ha scritto ----<br></div><div><br></div><blockquote style="border-left: 1px solid rgb(204, 204, 204); padding-left: 6px; margin: 0px 0px 0px 5px;"><style></style><div style="" class="zm_3880388228817387235_parse_4595706847723426186"><div class="x_1895577830WordSection1"><p style="margin: 0px;" class=""><span style="">Hm…</span><br></p><p style="margin: 0px;" class=""><span style=""> </span><br></p><p style="margin: 0px;" class=""><span style="">Did you initialize the session, e.g. like:</span><br></p><p style="margin: 0px;" class=""><span style=""> </span><br></p><p style="margin: 0px;" class=""><span style="">with Session(gisdb="/tmp", location="location", create_opts="EPSG:4326"):</span><br></p><p style="margin: 0px;" class=""><span style=""> from grass.pygrass.vector import Vector</span><br></p></div></div></blockquote></div><div><br></div><div>Yes it's exactly what I do, the strange fact is that I can by-pass the exception assigning the LD_LIBRARY_PATH value before running the script even if even now before importing vector lib this env variable has the correct value exactly thanks to the grass_session lib import...<br></div><div><br></div><div>so the script modified as you suggested reported here under still raise the exception<br></div><div><span class="font" style="font-family:"courier new", courier, monospace, sans-serif"><br></span></div><div><span class="font" style="font-family:"courier new", courier, monospace, sans-serif"><span class="highlight" style="background-color:rgb(204, 204, 204)"># -*- coding: utf-8 -*-<br></span></span></div><div><span class="font" style="font-family:"courier new", courier, monospace, sans-serif"><span class="highlight" style="background-color:rgb(204, 204, 204)"><br></span></span></div><div><span class="font" style="font-family:"courier new", courier, monospace, sans-serif"><span class="highlight" style="background-color:rgb(204, 204, 204)">import os, sys<br></span></span></div><div><span class="font" style="font-family:"courier new", courier, monospace, sans-serif"><span class="highlight" style="background-color:rgb(204, 204, 204)"><br></span></span></div><div><span class="font" style="font-family:"courier new", courier, monospace, sans-serif"><span class="highlight" style="background-color:rgb(204, 204, 204)">GISBASE = '/usr/lib/grass78'<br></span></span></div><div><span class="font" style="font-family:"courier new", courier, monospace, sans-serif"><span class="highlight" style="background-color:rgb(204, 204, 204)">GRASSBIN = '/usr/bin/grass78'<br></span></span></div><div><span class="font" style="font-family:"courier new", courier, monospace, sans-serif"><span class="highlight" style="background-color:rgb(204, 204, 204)"><br></span></span></div><div><span class="font" style="font-family:"courier new", courier, monospace, sans-serif"><span class="highlight" style="background-color:rgb(204, 204, 204)"># Define GRASS-Python environment<br></span></span></div><div><span class="font" style="font-family:"courier new", courier, monospace, sans-serif"><span class="highlight" style="background-color:rgb(204, 204, 204)">os.environ['GISBASE'] = GISBASE<br></span></span></div><div><span class="font" style="font-family:"courier new", courier, monospace, sans-serif"><span class="highlight" style="background-color:rgb(204, 204, 204)"><br></span></span></div><div><span class="font" style="font-family:"courier new", courier, monospace, sans-serif"><span class="highlight" style="background-color:rgb(204, 204, 204)">os.environ['GRASSBIN'] = GRASSBIN<br></span></span></div><div><span class="font" style="font-family:"courier new", courier, monospace, sans-serif"><span class="highlight" style="background-color:rgb(204, 204, 204)"><br></span></span></div><div><span class="font" style="font-family:"courier new", courier, monospace, sans-serif"><span class="highlight" style="background-color:rgb(204, 204, 204)">sys.path.append(os.path.join(GISBASE, "etc", "python"))<br></span></span></div><div><span class="font" style="font-family:"courier new", courier, monospace, sans-serif"><span class="highlight" style="background-color:rgb(204, 204, 204)"><br></span></span></div><div><span class="font" style="font-family:"courier new", courier, monospace, sans-serif"><span class="highlight" style="background-color:rgb(204, 204, 204)">from grass_session import Session<br></span></span></div><div><span class="font" style="font-family:"courier new", courier, monospace, sans-serif"><span class="highlight" style="background-color:rgb(204, 204, 204)">import grass.script as gs<br></span></span></div><div><span class="font" style="font-family:"courier new", courier, monospace, sans-serif"><span class="highlight" style="background-color:rgb(204, 204, 204)"><br></span></span></div><div><span class="font" style="font-family:"courier new", courier, monospace, sans-serif"><span class="highlight" style="background-color:rgb(204, 204, 204)">print(f"LD_LIBRARY_PATH: {os.environ['LD_LIBRARY_PATH']}")<br></span></span></div><div><span class="font" style="font-family:"courier new", courier, monospace, sans-serif"><span class="highlight" style="background-color:rgb(204, 204, 204)">print(f"GRASSBIN: {os.environ['GRASSBIN']}")<br></span></span></div><div><span class="font" style="font-family:"courier new", courier, monospace, sans-serif"><span class="highlight" style="background-color:rgb(204, 204, 204)"><br></span></span></div><div><span class="font" style="font-family:"courier new", courier, monospace, sans-serif"><span class="highlight" style="background-color:rgb(204, 204, 204)">with Session(gisdb="/tmp", location="location", create_opts="EPSG:4326"):<br></span></span></div><div><span class="font" style="font-family:"courier new", courier, monospace, sans-serif"><span class="highlight" style="background-color:rgb(204, 204, 204)"><br></span></span></div><div><span class="font" style="font-family:"courier new", courier, monospace, sans-serif"><span class="highlight" style="background-color:rgb(204, 204, 204)"> from grass.pygrass.vector import Vector<br></span></span></div><div><span class="font" style="font-family:"courier new", courier, monospace, sans-serif"><span class="highlight" style="background-color:rgb(204, 204, 204)"><br></span></span></div><div><span class="font" style="font-family:"courier new", courier, monospace, sans-serif"><span class="highlight" style="background-color:rgb(204, 204, 204)">print('DONE!')</span></span><br></div><div><br></div><div><br></div><div>while the old script (for convenience reported here under) runned as <br></div><div><br></div><div><span class="font" style="font-family: "courier new", courier, monospace, sans-serif;">$ LD_LIBRARY_PATH=$(grass78 --config path)/lib python import_test.py <br></span></div><div><span class="font" style="font-family: "courier new", courier, monospace, sans-serif;">LD_LIBRARY_PATH: /usr/lib/grass78/lib<br></span></div><div><span class="font" style="font-family: "courier new", courier, monospace, sans-serif;">GRASSBIN: /usr/bin/grass78<br></span></div><div><span class="font" style="font-family: "courier new", courier, monospace, sans-serif;">DONE!</span><br></div><div><br></div><div>returns just what printed in the script without raising the exception.<br></div><div><br></div><div><span class="font" style="font-family: "courier new", courier, monospace, sans-serif;"><span class="highlight" style="background-color:#cccccc"># -*- coding: utf-8 -*-</span><span class="highlight" style="background-color:#cccccc"><br></span></span></div><div><span class="font" style="font-family: "courier new", courier, monospace, sans-serif;"><span class="highlight" style="background-color:#cccccc"><br></span></span></div><div><span class="font" style="font-family: "courier new", courier, monospace, sans-serif;"><span class="highlight" style="background-color:#cccccc">import os, sys</span><span class="highlight" style="background-color:#cccccc"><br></span></span></div><div><span class="font" style="font-family: "courier new", courier, monospace, sans-serif;"><span class="highlight" style="background-color:#cccccc"><br></span></span></div><div><span class="font" style="font-family: "courier new", courier, monospace, sans-serif;"><span class="highlight" style="background-color:#cccccc">GISBASE = '/usr/lib/grass78'</span><span class="highlight" style="background-color:#cccccc"><br></span></span></div><div><span class="font" style="font-family: "courier new", courier, monospace, sans-serif;"><span class="highlight" style="background-color:#cccccc">GRASSBIN = '/usr/bin/grass78'</span><span class="highlight" style="background-color:#cccccc"><br></span></span></div><div><span class="font" style="font-family: "courier new", courier, monospace, sans-serif;"><span class="highlight" style="background-color:#cccccc"><br></span></span></div><div><span class="font" style="font-family: "courier new", courier, monospace, sans-serif;"><span class="highlight" style="background-color:#cccccc"># Define GRASS-Python environment</span><span class="highlight" style="background-color:#cccccc"><br></span></span></div><div><span class="font" style="font-family: "courier new", courier, monospace, sans-serif;"><span class="highlight" style="background-color:#cccccc">os.environ['GISBASE'] = GISBASE</span><span class="highlight" style="background-color:#cccccc"><br></span></span></div><div><span class="font" style="font-family: "courier new", courier, monospace, sans-serif;"><span class="highlight" style="background-color:#cccccc"><br></span></span></div><div><span class="font" style="font-family: "courier new", courier, monospace, sans-serif;"><span class="highlight" style="background-color:#cccccc">os.environ['GRASSBIN'] = GRASSBIN</span><span class="highlight" style="background-color:#cccccc"><br></span></span></div><div><span class="font" style="font-family: "courier new", courier, monospace, sans-serif;"><span class="highlight" style="background-color:#cccccc"><br></span></span></div><div><span class="font" style="font-family: "courier new", courier, monospace, sans-serif;"><span class="highlight" style="background-color:#cccccc">sys.path.append(os.path.join(GISBASE, "etc", "python"))</span><span class="highlight" style="background-color:#cccccc"><br></span></span></div><div><span class="font" style="font-family: "courier new", courier, monospace, sans-serif;"><span class="highlight" style="background-color:#cccccc"><br></span></span></div><div><span class="font" style="font-family: "courier new", courier, monospace, sans-serif;"><span class="highlight" style="background-color:#cccccc"># from grass_session import Session</span><span class="highlight" style="background-color:#cccccc"><br></span></span></div><div><span class="font" style="font-family: "courier new", courier, monospace, sans-serif;"><span class="highlight" style="background-color:#cccccc">import grass.script as gs</span><span class="highlight" style="background-color:#cccccc"><br></span></span></div><div><span class="font" style="font-family: "courier new", courier, monospace, sans-serif;"><span class="highlight" style="background-color:#cccccc"><br></span></span></div><div><span class="font" style="font-family: "courier new", courier, monospace, sans-serif;"><span class="highlight" style="background-color:#cccccc">print(f"LD_LIBRARY_PATH: {os.environ['LD_LIBRARY_PATH']}")</span><span class="highlight" style="background-color:#cccccc"><br></span></span></div><div><span class="font" style="font-family: "courier new", courier, monospace, sans-serif;"><span class="highlight" style="background-color:#cccccc">print(f"GRASSBIN: {os.environ['GRASSBIN']}")</span><span class="highlight" style="background-color:#cccccc"><br></span></span></div><div><span class="font" style="font-family: "courier new", courier, monospace, sans-serif;"><span class="highlight" style="background-color:#cccccc"><br></span></span></div><div><span class="font" style="font-family: "courier new", courier, monospace, sans-serif;"><span class="highlight" style="background-color:#cccccc"># with Session(gisdb="/tmp", location="location", create_opts="EPSG:4326"):</span><span class="highlight" style="background-color:#cccccc"><br></span></span></div><div><span class="font" style="font-family: "courier new", courier, monospace, sans-serif;"><span class="highlight" style="background-color:#cccccc"><br></span></span></div><div><span class="font" style="font-family: "courier new", courier, monospace, sans-serif;"><span class="highlight" style="background-color:#cccccc">from grass.pygrass.vector import Vector</span><span class="highlight" style="background-color:#cccccc"><br></span></span></div><div><span class="font" style="font-family: "courier new", courier, monospace, sans-serif;"><span class="highlight" style="background-color:#cccccc"><br></span></span></div><div><span class="font" style="font-family: "courier new", courier, monospace, sans-serif;"><span class="highlight" style="background-color:#cccccc">print('DONE!')</span></span><br></div><div><br></div><div>Cheers<br></div><div><br></div><div> Manuele<br></div><div><br></div><div class="zmail_extra" data-zbluepencil-ignore="true" style=""><blockquote style="border-left: 1px solid rgb(204, 204, 204); padding-left: 6px; margin: 0px 0px 0px 5px;"><div style="" class="zm_3880388228817387235_parse_4595706847723426186"><div class="x_1895577830WordSection1"><p style="margin: 0px;" class=""><span style=""> </span><br></p><p style="margin: 0px;" class=""><span style=""> </span><br></p><p style="margin: 0px;" class=""><span style="">Cheers</span><br></p><p style="margin: 0px;" class=""><span style="">Stefan</span><br></p><p style="margin: 0px;" class=""><span style=""> </span><br></p><div><div style="border: none;border-top: solid rgb(225,225,225) 1.0pt;padding: 3.0pt 0.0cm 0.0cm 0.0cm;"><p style="margin: 0px;" class=""><b><span>From:</span></b><span> grass-user <<a href="mailto:grass-user-bounces@lists.osgeo.org" target="_blank">grass-user-bounces@lists.osgeo.org</a>> <b>On Behalf Of </b>Manuele Pesenti<br> <b>Sent:</b> tirsdag 24. august 2021 09:38<br> <b>To:</b> Grass User <<a href="mailto:grass-user@lists.osgeo.org" target="_blank">grass-user@lists.osgeo.org</a>><br> <b>Subject:</b> Re: [GRASS-user] Error import from grass.pygrass.vector library</span></p></div></div><p style="margin: 0px;" class=""> <br></p><div><div><p style="margin: 0px;" class=""><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"> </span></span><br></p></div><p style="margin: 0px;" class=""><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt">Drear Stefan,<br> thanks for your quick reply but the solution is not so clear, I already use grass_session library even if not reported in the attached example, how can it helps with the issue? Just import the vector library after the session is loaded does not solve as far
as I've tested.<br> <br> Cheers<br> <br> Manuele</span></span></p><div><p style="margin: 0px;" class=""><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"> </span></span><br></p><div id="x_1895577830Zm-_Id_-Sgn1"><p style="margin: 0px;" class=""><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt">---- Attivato ven, 20 ago 2021 21:26:22 +0200 <b>Stefan Blumentrath <<a href="mailto:Stefan.Blumentrath@nina.no" target="_blank">Stefan.Blumentrath@nina.no</a>></b> ha scritto ----</span></span><br></p></div><p style="margin: 0px;" class=""><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"> </span></span><br></p><blockquote style="border: none;border-left: solid rgb(204,204,204) 1.0pt;padding: 0.0cm 0.0cm 0.0cm 5.0pt;margin-left: 3.75pt;margin-right: 0.0cm;"><div><div><p style="margin: 0px;" class=""><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt">Dear Manuele,</span></span><br></p><p style="margin: 0px;" class=""><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"> </span></span><br></p><p style="margin: 0px;" class=""><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt">For ctypes in pygrass, the C-libraries need to be loaded explicitly.</span></span><br></p><p style="margin: 0px;" class=""><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"> </span></span><br></p><p style="margin: 0px;" class=""><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt">You could have a look here:</span></span><br></p><p style="margin: 0px;" class=""><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"><a href="https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fzarch%2Fgrass-session%2Fblob%2F6097f834be20ee0d703deb2af90f22d6dc66f368%2Fgrass_session%2Fsession.py%23L332&data=04%7C01%7C%7C5490515dd62a4bc57acf08d966d433e6%7C6cef373021314901831055b3abf02c73%7C0%7C0%7C637653884462405890%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000&sdata=V0ecwomhbdvobU2B3tal1udBRXj5jkvWwN9e4K0dKSw%3D&reserved=0" target="_blank">https://github.com/zarch/grass-session/blob/6097f834be20ee0d703deb2af90f22d6dc66f368/grass_session/session.py#L332</a></span></span><br></p><p style="margin: 0px;" class=""><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt">to see how it can be done, or just use the grass_session python library (pip install grass-session) for convenience…</span></span><br></p><p style="margin: 0px;" class=""><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"> </span></span><br></p><p style="margin: 0px;" class=""><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt">Cheers</span></span><br></p><p style="margin: 0px;" class=""><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt">Stefan</span></span><br></p><p style="margin: 0px;" class=""><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"> </span></span><br></p><div><div style="border: none;border-top: solid rgb(225,225,225) 1.0pt;padding: 3.0pt 0.0cm 0.0cm 0.0cm;"><p style="margin: 0px;" class=""><b><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt">From:</span></span></b><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"> grass-user <<a href="mailto:grass-user-bounces@lists.osgeo.org" target="_blank">grass-user-bounces@lists.osgeo.org</a>> <b>On Behalf Of </b>Manuele Pesenti<br> <b>Sent:</b> fredag 20. august 2021 16:40<br> <b>To:</b> grass-user <<a href="mailto:grass-user@lists.osgeo.org" target="_blank">grass-user@lists.osgeo.org</a>><br> <b>Subject:</b> [GRASS-user] Error import from grass.pygrass.vector library</span></span></p></div></div><p style="margin: 0px;" class=""><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"> </span></span><br></p><div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt">Dear All,</span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"> </span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt">I'm moving my first steps on the development of a python script that uses Grass, but I cannot import from the grass.pygrass.vector library.</span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt">I work on a Ubuntu/Linux environment and I've installed grass using apt, this is the test script I'm currently running:</span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"> </span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="highlight" style="background-color:rgb(204, 204, 204)"><span class="colour" style="color:black"><span class="font" style="font-family:"Courier New""><span class="size" style="font-size: 10pt; background-position: 0% 0%; background-repeat: repeat; background-attachment: scroll; background-image: none; background-size: auto; background-origin: padding-box; background-clip: border-box;"># -*- coding: utf-8 -*-</span></span></span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"> </span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="highlight" style="background-color:rgb(204, 204, 204)"><span class="colour" style="color:black"><span class="font" style="font-family:"Courier New""><span class="size" style="font-size: 10pt; background-position: 0% 0%; background-repeat: repeat; background-attachment: scroll; background-image: none; background-size: auto; background-origin: padding-box; background-clip: border-box;">import os, sys</span></span></span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"> </span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="highlight" style="background-color:rgb(204, 204, 204)"><span class="colour" style="color:black"><span class="font" style="font-family:"Courier New""><span class="size" style="font-size: 10pt; background-position: 0% 0%; background-repeat: repeat; background-attachment: scroll; background-image: none; background-size: auto; background-origin: padding-box; background-clip: border-box;">GISBASE = '/usr/lib/grass78'</span></span></span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="highlight" style="background-color:rgb(204, 204, 204)"><span class="colour" style="color:black"><span class="font" style="font-family:"Courier New""><span class="size" style="font-size: 10pt; background-position: 0% 0%; background-repeat: repeat; background-attachment: scroll; background-image: none; background-size: auto; background-origin: padding-box; background-clip: border-box;">GRASSBIN = '/usr/bin/grass78'</span></span></span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"> </span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="highlight" style="background-color:rgb(204, 204, 204)"><span class="colour" style="color:black"><span class="font" style="font-family:"Courier New""><span class="size" style="font-size: 10pt; background-position: 0% 0%; background-repeat: repeat; background-attachment: scroll; background-image: none; background-size: auto; background-origin: padding-box; background-clip: border-box;"># Define GRASS-Python environment</span></span></span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="highlight" style="background-color:rgb(204, 204, 204)"><span class="colour" style="color:black"><span class="font" style="font-family:"Courier New""><span class="size" style="font-size: 10pt; background-position: 0% 0%; background-repeat: repeat; background-attachment: scroll; background-image: none; background-size: auto; background-origin: padding-box; background-clip: border-box;">os.environ['GISBASE'] = GISBASE</span></span></span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"> </span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="highlight" style="background-color:rgb(204, 204, 204)"><span class="colour" style="color:black"><span class="font" style="font-family:"Courier New""><span class="size" style="font-size: 10pt; background-position: 0% 0%; background-repeat: repeat; background-attachment: scroll; background-image: none; background-size: auto; background-origin: padding-box; background-clip: border-box;">os.environ['GRASSBIN'] = GRASSBIN</span></span></span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"> </span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="highlight" style="background-color:rgb(204, 204, 204)"><span class="colour" style="color:black"><span class="font" style="font-family:"Courier New""><span class="size" style="font-size: 10pt; background-position: 0% 0%; background-repeat: repeat; background-attachment: scroll; background-image: none; background-size: auto; background-origin: padding-box; background-clip: border-box;">sys.path.append(os.path.join(GISBASE, "etc", "python"))</span></span></span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"> </span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="highlight" style="background-color:rgb(204, 204, 204)"><span class="colour" style="color:black"><span class="font" style="font-family:"Courier New""><span class="size" style="font-size: 10pt; background-position: 0% 0%; background-repeat: repeat; background-attachment: scroll; background-image: none; background-size: auto; background-origin: padding-box; background-clip: border-box;">from grass_session import Session</span></span></span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="highlight" style="background-color:rgb(204, 204, 204)"><span class="colour" style="color:black"><span class="font" style="font-family:"Courier New""><span class="size" style="font-size: 10pt; background-position: 0% 0%; background-repeat: repeat; background-attachment: scroll; background-image: none; background-size: auto; background-origin: padding-box; background-clip: border-box;">import grass.script as gs</span></span></span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"> </span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="highlight" style="background-color:rgb(204, 204, 204)"><span class="colour" style="color:black"><span class="font" style="font-family:"Courier New""><span class="size" style="font-size: 10pt; background-position: 0% 0%; background-repeat: repeat; background-attachment: scroll; background-image: none; background-size: auto; background-origin: padding-box; background-clip: border-box;">print(f"LD_LIBRARY_PATH: {os.environ['LD_LIBRARY_PATH']}")</span></span></span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="highlight" style="background-color:rgb(204, 204, 204)"><span class="colour" style="color:black"><span class="font" style="font-family:"Courier New""><span class="size" style="font-size: 10pt; background-position: 0% 0%; background-repeat: repeat; background-attachment: scroll; background-image: none; background-size: auto; background-origin: padding-box; background-clip: border-box;">print(f"GRASSBIN: {os.environ['GRASSBIN']}")</span></span></span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"> </span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="highlight" style="background-color:rgb(204, 204, 204)"><span class="colour" style="color:black"><span class="font" style="font-family:"Courier New""><span class="size" style="font-size: 10pt; background-position: 0% 0%; background-repeat: repeat; background-attachment: scroll; background-image: none; background-size: auto; background-origin: padding-box; background-clip: border-box;">from grass.pygrass.vector import Vector</span></span></span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"> </span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="highlight" style="background-color:rgb(204, 204, 204)"><span class="colour" style="color:black"><span class="font" style="font-family:"Courier New""><span class="size" style="font-size: 10pt; background-position: 0% 0%; background-repeat: repeat; background-attachment: scroll; background-image: none; background-size: auto; background-origin: padding-box; background-clip: border-box;">print('DONE!')</span></span></span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"> </span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt">and this is the output:</span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"> </span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="font" style="font-family:"Courier New""><span class="size" style="font-size:10pt">$ python import_test.py </span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="font" style="font-family:"Courier New""><span class="size" style="font-size:10pt">LD_LIBRARY_PATH: /usr/lib/grass78/lib</span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="font" style="font-family:"Courier New""><span class="size" style="font-size:10pt">GRASSBIN: /usr/bin/grass78</span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="font" style="font-family:"Courier New""><span class="size" style="font-size:10pt">Traceback (most recent call last):</span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="font" style="font-family:"Courier New""><span class="size" style="font-size:10pt"> File "/usr/lib/grass78/etc/python/grass/lib/ctypes_loader.py", line 76, in load</span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="font" style="font-family:"Courier New""><span class="size" style="font-size:10pt"> return ctypes.cdll.LoadLibrary(path)</span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="font" style="font-family:"Courier New""><span class="size" style="font-size:10pt"> File "/usr/lib/python3.9/ctypes/__init__.py", line 452, in LoadLibrary</span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="font" style="font-family:"Courier New""><span class="size" style="font-size:10pt"> return self._dlltype(name)</span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="font" style="font-family:"Courier New""><span class="size" style="font-size:10pt"> File "/usr/lib/python3.9/ctypes/__init__.py", line 374, in __init__</span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="font" style="font-family:"Courier New""><span class="size" style="font-size:10pt"> self._handle = _dlopen(self._name, mode)</span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="font" style="font-family:"Courier New""><span class="size" style="font-size:10pt">OSError: libgrass_datetime.7.8.so: cannot open shared object file: No such file or directory</span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"> </span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="font" style="font-family:"Courier New""><span class="size" style="font-size:10pt">During handling of the above exception, another exception occurred:</span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"> </span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="font" style="font-family:"Courier New""><span class="size" style="font-size:10pt">Traceback (most recent call last):</span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="font" style="font-family:"Courier New""><span class="size" style="font-size:10pt"> File "/home/manuele/Lavoro/ETS/ETSCore/scripts/import_test.py", line 21, in <module></span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="font" style="font-family:"Courier New""><span class="size" style="font-size:10pt"> from grass.pygrass.vector import Vector</span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="font" style="font-family:"Courier New""><span class="size" style="font-size:10pt"> File "/usr/lib/grass78/etc/python/grass/pygrass/vector/__init__.py", line 5, in <module></span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="font" style="font-family:"Courier New""><span class="size" style="font-size:10pt"> import grass.lib.gis as libgis</span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="font" style="font-family:"Courier New""><span class="size" style="font-size:10pt"> File "/usr/lib/grass78/etc/python/grass/lib/gis.py", line 23, in <module></span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="font" style="font-family:"Courier New""><span class="size" style="font-size:10pt"> _libs["grass_gis.7.8"] = load_library("grass_gis.7.8")</span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="font" style="font-family:"Courier New""><span class="size" style="font-size:10pt"> File "/usr/lib/grass78/etc/python/grass/lib/ctypes_loader.py", line 62, in load_library</span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="font" style="font-family:"Courier New""><span class="size" style="font-size:10pt"> return self.load(path)</span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="font" style="font-family:"Courier New""><span class="size" style="font-size:10pt"> File "/usr/lib/grass78/etc/python/grass/lib/ctypes_loader.py", line 78, in load</span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="font" style="font-family:"Courier New""><span class="size" style="font-size:10pt"> raise ImportError(e)</span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="highlight" style="background-color:rgb(255, 204, 153)"><span class="colour" style="color:black"><span class="font" style="font-family:"Courier New""><span class="size" style="font-size: 10pt; background-position: 0% 0%; background-repeat: repeat; background-attachment: scroll; background-image: none; background-size: auto; background-origin: padding-box; background-clip: border-box;">ImportError: libgrass_datetime.7.8.so: cannot open shared object file: No such file or directory</span></span></span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"> </span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt">Thank you very mutch for any help</span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"> </span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt">Cheers</span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"> </span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"> Manuele</span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"> </span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"> </span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div><div><p style="margin: 0px;" class=""><span class="x_1895577830size"><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"> </span></span></span><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"></span></span><br></p></div></div><p style="margin: 0px;" class=""><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"> </span></span><br></p></div></div></blockquote></div><div><p style="margin: 0px;" class=""><span class="font" style="font-family:Verdana, sans-serif"><span class="size" style="font-size:10pt"> </span></span><br></p></div></div><p style="margin: 0px;" class=""> <br></p></div></div></blockquote></div><div><br></div></div><br></body></html>