[ZODB-Dev] ZEO2, sys.path, start.py and docs

Florent Guillaume fg@nuxeo.com
Mon, 20 Jan 2003 19:31:05 +0100


>   AvdD> adriand@baldrick:~/Zope/ZSS$ python lib/python/ZEO/start.py -p
>   AvdD> 9999 -D Traceback (most recent call last):
>   AvdD>   File "lib/python/ZEO/start.py", line 235, in main
>   AvdD> ImportError: No module named StorageServer
> 
>   AvdD> Upon inspection, I see that start.py does some sys.path
>   AvdD> munging, inserting 'lib/python'.  But later on, it does a
>   AvdD> os.chdir(env.var), so this path is now relative to the var
>   AvdD> directory.  The problem goes away if I use an absolute path to
>   AvdD> start.py or disable ZDaemon.
> 
> It looks like the code to munge the path is buggy, but it's not clear
> to me when (if ever) it worked correctly.
> 
> In all the ZEO installs I've seen/run, the ZEO software is installed
> in site-packages or in a directory that is manually added to
> PYTHONPATH before the start script is run.
> 
>   AvdD> Have I done something wrong or is the README incorrect?
> 
> The README is probably a bit out of date.  Either it or the code
> should be fixed.
> 
>   AvdD> I am using stock Debian/woody python2.1.3.
> 
>   AvdD> P.S.  It seems to me that this whole path-munging business is
>   AvdD> about finding where Zope lives, which would be solved with a
>   AvdD> (suprise, surprise) java-style ZOPE_HOME, set either at
>   AvdD> installation time or by the administrator.  Surely this would
>   AvdD> be easier and less error-prone than cryptic path-munging
>   AvdD> functions?
> 
> I agree that modifying sys.path at runtime is tricky.  I wouldn't
> be in favor of adding new environment variables.  PYTHONPATH should be
> sufficient to fix your problem.

FYI I fixed this, now
    python lib/python/ZEO/start.py -p 9999
works.

Florent

-- 
Florent Guillaume, Nuxeo (Paris, France)
+33 1 40 33 79 87  http://nuxeo.com  mailto:fg@nuxeo.com