[Pymilter] Python3: how to proceed

Tom Hendrikx tom at whyscream.net
Sun Oct 16 16:22:07 EDT 2016


Hi,

I wanted to invest some time in getting the python3 code working. This
is what I tried so far:

- created a virtualenv with python3.5
- cloned the pymilter master branch
- patched extension using 'patch miltermodule.c milter.patch'
- ran 'pip install -e .'

All of this was succesful

Then I created a minimal milter runner that runs the builtin
logging-only milter:

----------------
import os

import Milter

def main():
    os.umask(000)
    Milter.factory = Milter.Milter
    print("Python3 test milter starting")
    Milter.runmilter(
        "python3-test-milter",
        "/tmp/python3-test-milter.sock",
        600)
    print("Python3 test milter halting")

if __name__ == "__main__":
     main()
----------------

I run the milter, hook it up into postfix and open a telnet connection
to the MTA. This immediately results a traceback:

$ python run.py
Python3 test milter starting
Traceback (most recent call last):
  File "/opt/pymilter-py3/Milter/__init__.py", line 659, in
negotiate_callback
    m._setctx(ctx)
  File "/opt/pymilter-py3/Milter/__init__.py", line 260, in _setctx
    ctx.setpriv(self)
AttributeError: 'milterContext' object has no attribute 'setpriv'
Traceback (most recent call last):
  File "/opt/pymilter-py3/Milter/__init__.py", line 676, in close_callback
    m = ctx.getpriv()
AttributeError: 'milterContext' object has no attribute 'getpriv'

This looks as if the extension code (which defines the milterContext
object is not ready yet. Am I missing something? I'm a python developer
and want to help getting this to work, but I never really learned C, or
wrote any python extension code.

KInd regards,
	Tom

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://gathman.org/pipermail/pymilter/attachments/20161016/b527abd4/attachment.sig>


More information about the Pymilter mailing list