Had a couple interesting problems to solve today that I thought I’d note here. One was with a Python library not getting loaded correctly, and the other with some bulk email for a client going to spam. These are as much notes for me as for anyone else, so no guarantees on my writing quality here.
Python won’t load modules in pth file
The first problem was something I’ve done dozens of times before, and it all of a sudden wouldn’t work. In Python, if you add a file ending in .pth to your site-packages folder, and the file contains paths to directories containing other python modules, Python will automatically load that .pth file and add the directories listed on each line to its search path. While working on the installer for PISCES, it wasn’t doing it for me, even though I’ve successfully done it many times before. The key ended up being file encoding. I was creating this file using Advanced Installer (where I’d created them in Notepad++ or from another Python script before), and by default it sets the encoding to UTF-16. Python, when it encounters that file, silently skips over it. After looking at some of my successfully loaded files, I saw that they were all UTF-8 w/o BOM. Advanced Installer doesn’t have that option, so I tried UTF-8 w/BOM. Didn’t work still. Finally, I tried plain old ANSI encoding, which was an option in Advanced Installer, and Python read the file and made the modules in the listed directories available.
Emails going to Spam
I’m going to just skip to the diagnosis on this one. There were many factors behind these emails going to spam (as their usually are). SpamAssassin was giving a score of over 4 just for the emails coming from VerticalResponse alone (cumulative based upon a handful of rules), but the item that put the email over the edge, and which was in our control, was that the email had a large dollar figure in it – something in the range of $600,000. That got it flagged as LOTS_OF_MONEY. As far as I can tell, older versions of SpamAssasin gave this factor a score of somewhere between 1 and 2.2 or so, depending on the Bayesian spam score of the message, but if I’m understanding what I read correctly, newer versions seem to have zeroed out the value that this test has, but made it a trigger for other tests for advance fee fraud scams, etc. Found it pretty funny that you could get thrown into spam in part for mentioning a large sum of money.