[python-sybase] CS_MEM_ERROR only in CGI execution environment

Charles Bearden Charles.F.Bearden at uth.tmc.edu
Wed, 11 Aug 2004 11:12:00 -0500


> > I *am* setting LD_LIBRARY_PATH (using a shell script wrapper around
a
> > Python CGI script), but I guess it's non-Sybase libs that are not
being
> > found.
> [...]
>=20
> LD_LIBRARY_PATH is identical in both shell and CGI script environment.
> Same goes for SYBASE and SYBASE_OCS.
>=20
> None of the other environment variables seem even vaguely relevant.  I
> didn't have time in my most recent visit to slavishly copy the whole
> environment, but I'm doubting again that that's my problem...
>=20
> Still, you may well be right that this is a linking problem.
>=20
> Any other ideas??

I don't know what web server you are running or which version, but in a
previous job, when I routinely built the latest Apache 1.3 with some
bells and whistles, I recall there being some issues caused by mm shared
memory lib support being compiled in.  I was using mod_perl and mod_php
at the time, and not mod_python.  May not be relevant, since one problem
I recall led to the server not even starting.

One tip: 'os.environ' is a dictionary of environment variables for the
current script.  You can use this dictionary to initialize your script
to precisely the same environment your interactive shell enjoys, e.g.:

---------------------------------------------------------
import os
#-- Insert new path at front of LD_LIBRARY_PATH env var
os.environ['LD_LIBRARY_PATH'] =3D
  '/usr/local/freetds/lib:%s' % (os.environ['LD_LIBRARY_PATH'])
#-- Initialize SYBASE env var
os.environ['SYBASE'] =3D '/usr/local/freetds'
#-- etc. etc. etc.
---------------------------------------------------------

This might prevent a slip between the shell and the script ;-)

HTH,

Chuck Bearden
Systems Analyst III
School of Health Information Sciences
University of Texas at Houston
713.500.3954 (voice)
713.500.3907 (fax)
Charles.F.Bearden@uth.tmc.edu