[Mailman-Users] show_qfiles error

Mark Sapiro msapiro at value.net
Mon Mar 6 23:51:24 CET 2006

Axel Beckert - ecos gmbh wrote:
>> When I try to view the qfiles in my in out or retry directories I get an 
>> error like the following:
>> /usr/local/mailman/bin/show_qfiles qfiles/in/*.pck
>> ====================>  qfiles/in/1109557589.84778+7a750d59fd76a54b51168a615ef23e74f4088be9.pck
>> Traceback (most recent call last):
>>   File "/usr/local/mailman/bin/show_qfiles", line 74, in ?
>>     main()
>>   File "/usr/local/mailman/bin/show_qfiles", line 67, in main
>>     sys.stdout.write(msg.as_string())
>> AttributeError: 'str' object has no attribute 'as_string'
>Edit show_qfiles, remove the ".as_string()" after "msg" just leaving
>the line
>  sys.stdout.write(msg)
>This bug is still in Mailman 2.1.7. I initially had this problem with
>Mailman 2.1.5 on SuSE Linux 9.3 with Python 2.4, but also could
>reproduce it with 2.1.7 on SuSE Linux 10.0 with Python 2.4.1.
>Filed a bug report:
>Anyone can explain, why a string should be converted to a string?

It's more complicated than that. I don't know why you had a problem
originally with the out or retry queues, and I suspect that your
patched show_qfiles may have problems with them.

The issue, is that in the entry in the in queue, the msg is usually the
text of the incoming email, but elsewhere, the msg is a
Mailman.Message.Message object.

So, yes msg.as_string() is usually wrong for entries from the in queue,
but not elsewhere. I think a more appropriate patch is something like

@@ -64,7 +64,11 @@
         fp = open(filename)
         if filename.endswith(".pck"):
             msg = load(fp)
-            sys.stdout.write(msg.as_string())
+            data = load(fp)
+            if data.get('_parsemsg'):
+                sys.stdout.write(msg)
+            else:
+                sys.stdout.write(msg.as_string())

Mark Sapiro <msapiro at value.net>       The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan

More information about the Mailman-Users mailing list