Re: [exim-dev] Embedding Python

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: jgh
Ημερομηνία:  
Προς: exim-dev
Αντικείμενο: Re: [exim-dev] Embedding Python
On 01/05/2013 20:28, Todd Lyons wrote:
> The show-stopper problem I have so far is that I'm
> giving it a script to import that is in exim's config directory
> instead of in the python search path. From the shell, I can specify
> an additional subdirectory to look in when importing modules, but I
> couldn't find a simple function in the python api to make it add a
> path to the python module loader search paths.


http://docs.python.org/2/install/index.html
says:
==========
There are two environment variables that can modify sys.path. PYTHONHOME
sets an alternate value for the prefix of the Python installation. For
example, if PYTHONHOME is set to /www/python, the search path will be
set to ['', '/www/python/lib/pythonX.Y/',
'/www/python/lib/pythonX.Y/plat-linux2', ...].

The PYTHONPATH variable can be set to a list of paths that will be added
to the beginning of sys.path. For example, if PYTHONPATH is set to
/www/python:/opt/py, the search path will begin with ['/www/python',
'/opt/py']. (Note that directories must exist in order to be added to
sys.path; the site module removes paths that don’t exist.)
==========

So presumably if the exim process modifies its own environment in that
way before starting Python, we get what we need?
--
Cheers,
Jeremy