[Zope] z2.py

Wolfgang Strobl ws@gmd.de
Thu, 25 Jan 2001 12:57:44 +0100


While analyzing a problem, I had a quick look into z2.py, and 
frankly, I don't understand the logic behind the so called "required 
path hackery for the win32 binary distribution".

This hack unnecessarily makes the z2.py location dependant. The 
installer rewrites the z2.py source, inserting the absolute path of 
the zope home into a variable, from where it is used in getting 
some python folders in front of the python path. 

IMHO, this is nonsense.  A few lines down in z2.py, the absolute 
path to the zope home is constructed from sys.arg and os.cwd 
anyway.  Why not use that?

I removed the superflous stuff from the hack and moved the 
remaining lines down a few lines, now it comes right after the 
definition of  'here' and reads:

import sys
sys.path.insert(0, '%s/bin/lib' % here)
sys.path.insert(1, '%s/bin/lib/plat-win' % here)
sys.path.insert(2, '%s/bin/lib/win32' % here)
sys.path.insert(3, '%s/bin/lib/win32/lib' % here)

Works like a charm, both from a service (on win2000) and 
standalone.

ws