Hi, I've tried to use GRASS without starting it explicitly in Python. I've used example from wiki [1] which works. However, when I tried to use library functions through ctypes, I'm not able to import lib modules. I've added these lines to the example:
import grass.lib.gis as gis print gis.G_location_path() and the import fails with and error: Traceback (most recent call last): File "python_test_ctypes.py", line 23, in <module> import grass.lib.gis as gis File "/home/vasek/dev/grass/trunk/dist.i686-pc-linux-gnu/etc/python/grass/lib/gis.py", line 23, in <module> _libs["grass_gis.7.0.svn"] = load_library("grass_gis.7.0.svn") File "/home/vasek/dev/grass/trunk/dist.i686-pc-linux-gnu/etc/python/grass/lib/ctypes_loader.py", line 55, in load_library return self.load(path) File "/home/vasek/dev/grass/trunk/dist.i686-pc-linux-gnu/etc/python/grass/lib/ctypes_loader.py", line 72, in load raise ImportError,e ImportError: libgrass_datetime.7.0.svn.so: cannot open shared object file: No such file or directory I placed print path to the ctypes/loader.py file (line 71) and I get this output: /home/vasek/dev/grass/trunk/dist.i686-pc-linux-gnu/lib/libgrass_gis.7.0.svn.so This file exists (checked on disk and also python code checks this in the function load_library) and libgrass_datetime.7.0.svn.so exists in the same folder, too. The output of print os.environ['LD_LIBRARY_PATH'] is: :/home/vasek/dev/grass/trunk/dist.i686-pc-linux-gnu/lib Running this script in GRASS session works. Vaclav [1] http://grasswiki.osgeo.org/wiki/Working_with_GRASS_without_starting_it_explicitly#Python_example [2] http://grasswiki.osgeo.org/wiki/GRASS_and_Python#Creating_Python_scripts_that_call_GRASS_functionality_from_outside (BTW, these to sections could be merged together.)
python_test_ctypes.py
Description: Binary data
_______________________________________________ grass-dev mailing list grass-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-dev