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 sys
import string
home = os.path.expanduser("~")
Zopes = os.path.join(home, 'Zope')
pt = os.path.join(Zopes, 'pt')
libPython = os.path.join(pt, 'lib', 'python')
sys.path.append(libPython)
dir = os.path.dirname(__file__)
path = os.path.join(dir, ".path")
try:
f = open(path)
except IOError:
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
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