Commit b63260b3 authored by Guido van Rossum's avatar Guido van Rossum

Evan checked in *his* version of setpath.py, which broke for me.

To prevent this in the future, read the path from a file .path.
parent 54e7e207
""" """
Edit this file to set the proper module search path. Read a module search path from .path.
""" """
import os import os
import sys import sys
import string
home = os.path.expanduser("~") dir = os.path.dirname(__file__)
Zopes = os.path.join(home, 'Zope') path = os.path.join(dir, ".path")
pt = os.path.join(Zopes, 'pt') try:
libPython = os.path.join(pt, 'lib', 'python') f = open(path)
except IOError:
sys.path.append(libPython) raise IOError, "Please edit .path to point to <Zope2/lib/python>"
else:
for line in f.readlines():
line = string.strip(line)
if line and line[0] != '#':
for dir in string.split(line, os.pathsep):
dir = os.path.expanduser(os.path.expandvars(dir))
if dir not in sys.path:
sys.path.append(dir)
import ZODB # Must import this first to initialize Persistence properly import ZODB # Must import this first to initialize Persistence properly
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment