Zope Tip

Let’s say you’re messing about with Zope, and you want to access something that’s not on your $PYTHONPATH. Usually, you’d just add a .pth file to your site-packages directory, right? But what if you don’t want to?

a = ‘/path/to/desired/directory/’
import sys
sys.path.insert(0, a)
import foo # Used to get an error on this import!

def whatever(self):
    return foo.bar(args)


That last sys.path.remove is necessary so you don’t start stacking up multiple, identical entries in the sys.path list, especially with the long-running Zope process.

One thought on “Zope Tip

  1. Wait, I thought Zope was out in favor of WebWare, which was on the way out in favor of mod_python.

    Dude, you’re like a chick. Make up your damn mind. (Yeah, yeah, I’m one to talk.)

Comments are closed.