zope startup configuration/setup with cutom PYTHONPATH in runzope & zopectl
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Zope 2 |
Won't Fix
|
Medium
|
Unassigned |
Bug Description
In order to add additional pathnames to PYTHONPATH environment variable, for whatever reason, changes need to be made to both the zopectl and runzope startup scripts. Say, you have some python libraries on a particular path on the filesystem like /use/local/
In zopectl you make the change
PYTHONPATH=
This PYTHONPATH is not effective unless you make the change to runzope as well. Otherwise any python file you import from PATHNAME results in a ImportError. This probably result from a startup configuration that is mixed up and looks at both runzope and zopectl. Thankfully, Dieter Maurer pointed me the solution of changing it in both runzope and zopectl. Otherwise, I would be stuck with using sys.path = sys.path + [PATHNAME] in every file I needed to import files from PATHNAME. Thanks once again Dieter. This is the email Dieter sent me.
>...
>> From what I read on zope.org mailing list (keywork PYTHONPATH),
>>somebody had said to look at the pathnames in sys.path and compare them.
>>When I print sys.path in zopectl.py, I see all the pathnames I need.
>>However, by the time zope imports my half-baked product, the pathnames I
>>need and I set using PYTHONPATH are not there anymore. That to me was a
>>little odd. I really appreciate your help regarding this. Thank you very
>>much. It has helped me understand ImportErrors a little better.
A misfeature of the startup/
Unfortunately, you must modify "PYTHONPATH" both in "zopectl"
as well as in "runzope".
Depending on how you start Zope (which "action" you use for "zopectl"),
the definition in "zopectl" or "runzope" is effective.
Maybe, you consider to file a bug report (as affairs could be improved).
-- Dieter
Today we use virtualenv or buildout to influence the PYTHONPATH available to the running Zope process.