[GRASS-dev] python grass problems on OSX (Incompatible library
version for module)
Glynn Clements
glynn at gclements.plus.com
Sun May 10 21:32:44 EDT 2009
massimo di stefano wrote:
> i'm tring to utilize a python function iside the grass environment,
> but i gett errors about :
>
> "Incompatible library version for module"
If "make clean" and rebuilding doesn't fix it, then it sounds like you
have more than one version of GRASS on your system, and it's picking
up the wrong libraries.
> outside a running GRASS, it works from python. From python started
> inside a GRASS shell, it doesn't work.
That sounds like multiple versions.
> the function i'm using is prety simple :
>
>
>
> ###
> import os
> import subprocess
>
> def OssimImg2rr(img1):
> os.environ['DYLD_FRAMEWORK_PATH'] = '/var/tmp/XcodeBuilds/Release'
> os.environ['OSSIM_PREFS_FILE'] = '/Users/sasha/ossim_preferences'
> output = subprocess.Popen(['/var/tmp/XcodeBuilds/Release/img2rr' ,str(img1)],stdout=subprocess.PIPE).communicate()[0]
Leave os.environ alone; create a new environment dictionary and pass
that to subprocess.Popen(), e.g.:
myenv = os.environ.copy()
myenv['DYLD_FRAMEWORK_PATH'] = '/var/tmp/XcodeBuilds/Release'
myenv['OSSIM_PREFS_FILE'] = '/Users/sasha/ossim_preferences'
output = subprocess.Popen(..., env = myenv).communicate()[0]
This isn't related to this specific problem, though, just general
Python coding advice.
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev
mailing list