Page 1 of 1

python on c.local-delivery.sonic.net (or other servers running procmail)?

Posted: Mon Aug 14, 2023 10:08 am
by cpark
My .procmail has short python snippets (e.g., to translate a string like "157,131,224,146" to a hex thingy like "9d83e092"). Some time near 2023-06-16 those snippets stopped working.

Here's the .procmailrc extract:

Code: Select all

            LRAHEX=`python -c "print '%02x%02x%02x%02x' % ($LRACOMMA)"`
Did something change on c.local-delivery.sonic.net? I also have a script (not just a snippet) that gets invoked once every month or two; it does a mailmerge kind of thing for a friend that works for a nonprofit. That also stopped working (worked on June 11, failed August 9th).

Was this a decision, to disable python scripts from getting invoked by procmail? Is python not installed on these boxes? Do I need to add something to $PATH?

Enquiring minds want to know! Thanks!

Re: python on c.local-delivery.sonic.net (or other servers running procmail)?

Posted: Mon Aug 14, 2023 10:50 am
by joemuller
We recently upgraded the local-delivery servers to a newer Linux release, which use python3 by default and do not have the older python2 available. The syntax requirements are a bit more strict for python3 versus python 2.x, so my hunch is that you need to make sure your code is valid for python3 for it to not error. This is usually something simple like making sure that calls to 'print' include (previously optional) parentheses.

-- Joe M
System Operations

Re: python on c.local-delivery.sonic.net (or other servers running procmail)?

Posted: Mon Aug 14, 2023 10:58 am
by cpark
Brilliant. 3.9.16 -- quite respectable.

Thank you!!

For anybody else contemplating this, here's what i did:
In .procmailrc:

Code: Select all

:0 bfw
* ^Subject:.*xyzzy
| python3 --version
Then I emailed myself as

Code: Select all

$ mail -s xyzzy collin@rc5.us
python3 does it work?
^D
and observed

Code: Select all

To: collin@rc5.us
Subject: xyzzy
User-Agent: Heirloom mailx 12.5 7/5/10
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Sonic-CAuth: UmFuZG9tSVaNemWmp6KjDoUFJ5hesLYAFonppHDGPjKZpbZXvbbgzLa6CML234uXfey24d4zYbla839tFkO0EkW2SHddArlQV39X89mQoto=
X-Sonic-ID: C;np0sv8s67hGIup4CP63e0g== M;Zhs3v8s67hGIup4CP63e0g==
X-Spam-Flag: No
X-Sonic-Spam-Details: 0.0/5.0 by cerberusd
X-Orthrus: rip=64.142.111.50 rhost=d.mail.sonic.net tar=0 grey=no co=US os=Linux/3.11 and newer/1652 spf=pass dkim=none
Date: Mon, 14 Aug 2023 10:55:26 PDT

Python 3.9.16