Re: [exim-dev] Embedding Python

Top Page
Delete this message
Reply to this message
Author: Phil Pennock
Date:  
To: Todd Lyons
CC: exim-dev
Subject: Re: [exim-dev] Embedding Python
On 2013-05-01 at 12:28 -0700, Todd Lyons wrote:
> Over the past couple of days, while ironing out the kinks in the build
> process, I was hitting an issue getting the python code to import. I
> went and asked in the #python irc channel. HOLY CRAP was that the
> wrong thing to do. I was told I was stupid for trying to embed python
> into an existing app because I lose so much of the power of python. I
> was also told it would probably be just as stupid to embed perl into
> my app. I admit I kind of laughed at that. They referred me to
> http://twistedmatrix.com/users/glyph/rant/extendit.html which kindly
> explains that I should reconfigure my app to be a module of python,
> not to embed python in the app.


Yeah, I'm familiar with that stance, and if you're starting from scratch
it makes a certain amount of sense, but being unable to accept existing
code and work with it, instead of fighting it, is unfortunate and not
pragmatic.

> My question to the devs is simple: is it even worth my time to give
> embedded python capability to exim?


Yes. I'd use it. I wanted to find time to write the code myself, I'm
very glad you're doing so.

> Python has a very simple initialization procedure, that part works
> with no issues. 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.


Manipulate the existing sys.path variable using the normal list
manipulation API?

-Phil