[GRASS-dev] [GRASS GIS] #2424: PyGRASS does not work when GRASS is invoked from outside

GRASS GIS trac at osgeo.org
Sun Feb 2 20:24:15 PST 2020


#2424: PyGRASS  does not work when GRASS is invoked from outside
-------------------------+-------------------------------------------------
  Reporter:  wenzeslaus  |      Owner:  grass-dev@…
      Type:  defect      |     Status:  new
  Priority:  normal      |  Milestone:  7.2.4
 Component:  Python      |    Version:  svn-trunk
  ctypes                 |   Keywords:  installation, pygrass, temporal,
Resolution:              |  scripts
       CPU:              |   Platform:  MSWindows 8
  Unspecified            |
-------------------------+-------------------------------------------------

Comment (by wenzeslaus):

 Replying to [comment:16 martinl]:
 > Still relevant?

 Yes. As far as I know only thing which changed is having additional
 workaround (besides explicit `LD_LIBRARY_PATH` or `--exec` and that is
 installing `grass-session/grass_session` which is technically a 3rd party
 package in that sense that it is not part of GRASS GIS.

 Replying to [comment:17 sbl]:
 > Here is a way to load PyGRASS libs in external Python:
 >
 > https://github.com/ninsbl/grass-
 session/blob/grass_versions/grass_session/session.py#L305
 >
 > Not sure if this is what you are looking for?

 Yes, `ctypes.CDLL(lib, mode=1)` looks like a way to address the issue. It
 doesn't seem right to me that code to make GRASS GIS API work is outside
 of GRASS GIS. Any ideas or opinions on having grass-session functionality
 in GRASS GIS? Perhaps even avoiding the need for grass-session?

 > Have not tested on Windows either...

 Yes, that's a big concern here because `LD_LIBRARY_PATH`-like solution is
 not practical there (and setting `GRASSBIN` is not either) and then there
 is the issue of multiple Pythons and where or how to install grass-session
 (which is actually not limited to Windows).

-- 
Ticket URL: <https://trac.osgeo.org/grass/ticket/2424#comment:18>
GRASS GIS <https://grass.osgeo.org>



More information about the grass-dev mailing list