[Zope] Zope binary and Mysqldb

Dieter Maurer dieter@handshake.de
Sun, 4 Nov 2001 19:35:02 +0100


s.morris@bangor.ac.uk writes:
 > Having installed a binary version of Zope I'm having some difficulty installing 
 > MySQLdb (so I can use . The python on the system can import MySQL but python 
 > installed with Zope cannot import the module.
 > 
 > What do I need to do to install MySQLdb module so that the python that was 
 > installed with Zope can see it?
You need to learn something about PYTHONPATH (--> Python documentation):

  Python uses the environment variable PYTHONPATH to initialize its
  package/module search path (maintained in "sys.path").
  Its a colon separated list of directories (maybe ';' separated under
  Windows).
  Besides the directories mentioned in PYTHONPATH, Python adds
  some directories from its installation (which can be controlled by the
  environment variable PYTHONHOME; if not set, the path to the interpreter
  is used to derive the value; if no libraries are found there, default
  values are used).

Zope's start script adds "lib/python" to "sys.path" such that
usually packages/modules are found in "<Zopedir>/lib/python".

Your options:

  *  define/extend PYTHONPATH such that it can find the MySQLdb module
     before you start

  *  use Zope with your (natively) installed Python rather than
     the included one. This would mean: change "start" to
     use your standard Python.

  *  define PYTHONHOME to point to your native Python installation

  *  make a link to the MySQLdb module in a place found by your
     Zope Python (i.e. in "<ZopeDir>/lib/python".

  *  there are several mode ways, when you use INSTANCE_HOME,
     SOFTWARE_HOME variables (--> HowTo on Zope.org).

You see, there are lots of ways....
already discussed and to be found in the mailing list archives...


Dieter