[Zope-dev] Error by using libraries with an external method
Matt Behrens
matt.behrens@kohler.com
Mon, 24 Jun 2002 07:26:02 -0400
Dario Lopez-Kästen wrote:
> From: "Leonardo Rochael Almeida" <leo@hiper.com.br
>>Putting it in the Extesions directory, so that it can be imported by
>>external methods, doesn't seem to work, even if you put Extensions in
>>the PYTHONPATH, at least in my experience.
> hm... Putting it in the Extensions directory has worked for me using Zope
> 2.4.3 (I don't like to mess with the PYTHONPATHG in the Python Install)...
> Has this changed in later zopes?
What's wrong with twiddling PYTHONPATH?
My instance home has a 'Packages' directory, where I have stuff like
_ldapmodule.so (for ZLDAP), imaging.so, and the PIL and ldap packages.
My start script looks like this:
----
#!/bin/sh
PYTHON_VER=2.1.3
ZOPE_VER=2.5.1
INSTANCE_HOME=/zope
PYTHONPATH=$INSTANCE_HOME/Packages
export INSTANCE_HOME PYTHONPATH
STUPID_LOG_FILE=$INSTANCE_HOME/var/log/zlog_`date +%Y%m%d`.log
STUPID_LOG_SEVERITY=-200
export STUPID_LOG_FILE STUPID_LOG_SEVERITY
echo `date` starting >> $INSTANCE_HOME/var/log/start_`date +%Y%m%d`.log
exec $INSTANCE_HOME/Python-$PYTHON_VER/bin/python2.1 \
$INSTANCE_HOME/Zope-$ZOPE_VER/z2.py \
-F $INSTANCE_HOME/var/FastCGI.soc -m 8099 -p - "$@" \
>> $INSTANCE_HOME/var/log/start_`date +%Y%m%d`.log 2>&1
----
All in all, it works pretty well. No need to sweat messing with
PYTHONPATH. All instance homes should do this, and have a Packages
directory :-)