On Wed, Mar 3, 2010 at 4:44 PM, Mark Sapiro <mark@msapiro.net> wrote:
On 3/3/2010 12:57 AM, Cedric Jeanneret wrote:
On Tue, 02 Mar 2010 11:34:25 -0800 Mark Sapiro <mark@msapiro.net> wrote:
On 3/2/2010 3:41 AM, Cedric Jeanneret wrote: [...]
from cStringIO import StringIO [...] f = StringIO(str(msg)) h = HyperArch.HyperArchive(mlist) h.processUnixMailbox(f) [...]
Hmm, it seems it crashes in pipermail.py, in function processUnixMailbox: we have a pos = input.tell() on line 564, but unfortunately "input" does NOT have any "tell()" method... It returns a "41" status.
Something is strange. The input object in 'pos = input.tell()' is the StringIO instance you passed as 'f', and StringIO objects do have a tell method. Also, the above code snippet is exactly what the builtin archiver uses, and I tested it and it worked for me.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
Maybe a python version? What is really strange is that it works inside the archiver.... I tried to NOT use email.message_from_file (so use directly StringIO on sys.stdin), and it worked fine. In fact, the error was that "Message doesn't have "tell()" method"...
Another error was really annoying : ALL worked. almost. I couldn't do my mlist.Save(), as there was an error for the lockfile.
I did : mlist = MailList.MailList('toto', lock=False) # other code mlist.Save()
-> crashed. After poking into MailList code, I saw that it refreshes the lockfile. Commenting out this line made it work again.... more or less : message was in mbox, but wasn't in pipermail archives....
Poking on the Net, I found this post http://www.mail-archive.com/mailman-users@python.org/msg47499.html you answered some months (well, years) ago. I tried this way : applying the patch, so that it uses mailman internal archiver, and it calls my indexer right after. That's not really clean, it's not really a portable way, but it works. The fact that I have to patch a file from mailman package annoy me a bit, but... I didn't have any success with the ways you showed me :(
To be honnest, maybe I'll try to put a handler (like XapianIndexer.py) for this. As I saw how to debug my scripts (thank you for the tip), I guess it would be the best way, instead of patching a code (which will be overriden on the next update).
Or maybe there's a variable in mm_config (or defaults) which tell mailman to call a script after archiving ? I didn't see such a thing, I guess that's the role a the GLOBAL_PIPELINE and its handlers chain...
Thank you for the time you spend on my problem.
Best regards,
C.