[GRASS-dev] re: python grass problems on OSX (Incompatible library version for module)

I'm tring to debug these weird situation ....

assured that only osx is affcted by these problems, (on linux i've no problems)

i tried to run the img2rr executable, using python inside a grass session (6.4, 6.5 & 7.0)
using a grass raster file it do not works, while using a simple geotif instead of a grass file ... it works :

GRASS 6.4.0RC3 (spearfish60):~ > export OSSIM_PREFS_FILE=/Users/sasha/ossim_preferences
GRASS 6.4.0RC3 (spearfish60):~ > ipythonPython 2.5.1 (r251:54863, Jan 13 2009, 10:26:13)
Type "copyright", "credits" or "license" for more information.

IPython 0.9.1 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.

In [1]: import os
In [2]: import subprocess
In [3]: subprocess.call('/var/tmp/XcodeBuilds/Release/img2rr /Users/Shared/grassdata/spearfish60/PERMANENT/cellhd/geology', shell=True)
MPI running with 1 processors...
ERROR: Incompatible library version for module
Out[3]: 1

^^^ Using a grass raster file.

In [5]: subprocess.call('/var/tmp/XcodeBuilds/Release/img2rr /Users/sasha/Desktop/desk/dsmc.tif', shell=True)
MPI running with 1 processors...
Creating overviews for file: /Users/sasha/Desktop/desk/dsmc.tif
creating r1...
100%
creating r2...
100%
creating r3...
100%
creating r4...
100%
creating r5...
100%
creating r6...
100%
creating r7...
100%
creating r8...
100%
creating r9...
100%
creating r10...
100%
creating r11...
100%
creating r12...
100%
Finished...
Elapsed time: 5
Out[5]: 0

^^^ Using a GTiff file

so ... the problem is in :
export OSSIM_PREFS_FILE=/Users/sasha/ossim_preferences

inside grass - python it do not works as aspected.

here other debug :

start a new grass shell, omitting the step :

export OSSIM_PREFS_FILE=/Users/sasha/ossim_preferences

GRASS 6.4.0RC3 (spearfish60):~ > ipython
..
...
In [1]: import os
In [2]: import subprocess
In [3]: subprocess.call('/var/tmp/XcodeBuilds/Release/img2rr /Users/Shared/grassdata/spearfish60/PERMANENT/cellhd/geology', shell=True)
MPI running with 1 processors...
WARNING: Unable to open image file /Users/Shared/grassdata/spearfish60/PERMANENT/cellhd/geology
Elapsed time: 0
Out[3]: 0

^^^ the same message come up in bash too, if i don't export the "OSSIM_PREFS_FILE=/Users/sasha/ossim_preferences"

adding the export line :

In [4]: os.environ['OSSIM_PREFS_FILE'] = '/Users/sasha/ossim_preferences'

In [5]: subprocess.call('/var/tmp/XcodeBuilds/Release/img2rr /Users/Shared/grassdata/spearfish60/PERMANENT/cellhd/geology', shell=True)
MPI running with 1 processors...
ERROR: Incompatible library version for module
Out[5]: 1

it give me the lib error

but ... the libs are not broken!
beacouse inside a standard python it works :

In [1]: import os

In [2]: import subprocess

In [3]: os.environ['OSSIM_PREFS_FILE'] = '/Users/sasha/ossim_preferences'
In [4]: subprocess.call('/var/tmp/XcodeBuilds/Release/img2rr /Users/Shared/grassdata/spearfish60/PERMANENT/cellhd/geology', shell=True)
MPI running with 1 processors...
Creating overviews for file: /Users/Shared/grassdata/spearfish60/PERMANENT/cellhd/geology
creating r1...
100%
creating r2...
100%
creating r3...
100%
creating r4...
100%
creating r5...
100%
creating r6...
100%
Finished...
Elapsed time: 0
Out[4]: 0

doing a more depth debug ....
i tried to wrote a script in grass, to avoid use of python, that is :

####################################
#!/bin/sh
#% Module
#% description: Calculates Optimum-Index-Factor table for LANDSAT TM bands 1-5, & 7
#% keywords: raster, imagery, statistics
#% End
#% option
#% key: image1
#% type: string
#% gisprompt: old,cell,raster
#% description: LANDSAT TM band 1.
#% required : yes
#% end

if [ -z "$GISBASE" ]
then
  echo "You must be in GRASS GIS to run this program" >&2
  exit 1
fi

if [ "$1" != "@ARGS_PARSED@" ]
then
  exec g.parser "$0" "$@"
fi

eval `g.gisenv`
: ${GISBASE?} ${GISDBASE?} ${LOCATION_NAME?} ${MAPSET?}
LOCATION=$GISDBASE/$LOCATION_NAME/$MAPSET

export OSSIM_PREFS_FILE=/Users/sasha/ossim_preferences
/var/tmp/XcodeBuilds/Release/img2rr $LOCATION/cellhd/$GIS_OPT_IMAGE1

####################################

unlucky i get the same error :

GRASS 6.4.0RC3 (spearfish60):~ > i.img2rr image1=geology
MPI running with 1 processors...
ERROR: Incompatible library version for module

... at least i eliminate the python ... as the cause of my problrems :frowning:

please people help mde to know what is the problem, if exists a wok-around ... or do you know a solution ...

but ... maybe a know the answer, is these problem generated by a difference in the libs that i'm using to build ossim and grass ???

for the build i'm using the exactly same gdal.framework ... but my think is about tiff/libgeotiff files ... maybe they can be the cause?

any suggestion is really welcome!

Have you any ideas about these weird behavioure, why it happens, how to debug it ?

please tell me if you need better description, or log.

Thanks!!!

Massimo Di Stefano
massimodisasha@yahoo.it

epifanio on irc.freenode.net /join gfoss

Chiacchiera con i tuoi amici in tempo reale! http://it.yahoo.com/mail_it/foot/*http://it.messenger.yahoo.com