Python Packages via Easy Install for a Unified-Installer-built Plone

18 12 2007

Because Plone/Zope requires an older version of Python than comes out of the box with many OS’s, some people recommend installing Plone with the Unified Installer. On Unix-like systems, the Unified Installer builds Python, Zope, Plone, and some dependencies from source and keeps the whole shebang relatively segregated from the rest of the OS.

This is great until you need to install an additional Python package for a Plone product. For which of your multiple Python versions will your installer build the package? This question would be frustrating enough even if there weren’t at least five different installers for Python packages.

The installer I use, and the one I’ll write about here, is Easy Install, which comes with setuptools. Having much experience with Perl, I chose Easy Install because it’s supposedly “the closest thing to CPAN currently available for Python.” One problem with Easy Install is that it tends to install packages in the system Python site-packages directory. Here’s how to easy_install packages for the Python built by the Unified Installer:

  1. cd $ZOPE/bin
  2. wget
  3. ./python
  4. ./python -m easy_install $package_name

Voila! See the Easy Install docs for details about why this works.

You may also want to set up some aliases for your various Pythons.

Zope debug-mode: designed to produce silent failures!

12 12 2007

Much to my bemusement, a minor change to a Plone product I’m writing caused Zope to silently fail to start. Why no error message? Since I was running Zope in debug-mode, this seemed like a problem. After exhausting what I thought were the obvious approaches to diagnosing the problem, I finally decided to review what debug-mode does. From the zope.conf that comes with Zope 2.9.7-final:

# Directive: debug-mode
# Description:
# A switch which controls several aspects of Zope operation useful for
# developing under Zope. When debug mode is on:
# - The process will not detach from the controlling terminal
# - Errors in product initialization will cause startup to fail
# (instead of writing error messages to the event log file).

So Zope debug-mode is designed to produce silent failures for “errors in product initialization”. Absolute fucking genius. Principle of Least Astonishment, anyone?