Re: [Mailman-Developers] Uncaught runner exception: 'generator' object has no attribute 'insert'
Sure I did.
asp pts/25% python ~ Python 2.2b2 (#1, Nov 19 2001, 20:23:17) [GCC 2.96 20000731 (Red Hat Linux 7.1 2.96-98)] on linux2 Type "help", "copyright", "credits" or "license" for more information.
import email email.__version__ '1.0'
Pavel
Cituji z emailu od Dan Mick dmick@utopia.West.Sun.COM:
With 2.1 you have to install the 'email' package, which is included, as the instructions with 2.1 say to do. Did you?
Pavel Chytil wrote:
Hello,
I am new to mailman, so bear with me. I have downloaded mailman-2.0.7
which
works fine, than I have tried mailman 2.1 (also from cvs), and getting error message below in error log whenever I try to send email to mailman-request@asp.ogi.edu with word help in Subject line (I have tried also word help in body of message without any luck).
Nov 25 16:24:47 2001 (11789) Uncaught runner exception: 'generator' object has no attribute 'insert' Nov 25 16:24:47 2001 (11789) Traceback (most recent call last): File "/work/mailman/Mailman/Queue/Runner.py", line 104, in __oneloop self.__onefile(msg, msgdata) File "/work/mailman/Mailman/Queue/Runner.py", line 152, in __onefile keepqueued = self._dispose(mlist, msg, msgdata) File "/work/mailman/Mailman/Queue/CommandRunner.py", line 61, in _dispose mlist.ParseMailCommands(msg, msgdata) File "/work/mailman/Mailman/MailCommandHandler.py", line 198, in ParseMailCommands lines.insert(0, SPACE.join(subjcmd)) AttributeError: 'generator' object has no attribute 'insert'
What am I doing wrong?
Thanks, Pavel
Mailman-Developers mailing list Mailman-Developers@python.org http://mail.python.org/mailman/listinfo/mailman-developers
Dan,
He is using Python 2.2, which comes with email - no need to install the package. The problem lies elsewhere.
Bob
"B" == Bob bob@nleaudio.com writes:
B> He is using Python 2.2, which comes with email - no need to
B> install the package. The problem lies elsewhere.
Yes, the problem is that in Python 2.2, body_line_generator() returns a... generator! not a list. This is one corner where email 1.0 and email 0.96 are not completely compatible, and it's not really feasible to make them so here. The following patch should fix this particular problem. Let me know and I'll commit it to cvs.
I haven't extensively tested Mailman with 2.2, but I will have to do this before Python 2.2 final is released.
-Barry
Oops, forgot the patch! -Barry Index: MailCommandHandler.py =================================================================== RCS file: /cvsroot/mailman/mailman/Mailman/MailCommandHandler.py,v retrieving revision 2.24 diff -u -r2.24 MailCommandHandler.py --- MailCommandHandler.py 2001/11/21 17:17:35 2.24 +++ MailCommandHandler.py 2001/11/27 04:19:23 @@ -181,7 +181,7 @@ if mo: subject = mo.group('cmd') - lines = email.Iterators.body_line_iterator(msg) + lines = email.Iterators.body_line_iterator(msg)[:] # Find out if the subject line has a command on it subjcmd = []
Barry,
well probably did fix what it suppose to, but new pop up as well:
Nov 26 22:23:38 2001 (11876) Uncaught runner exception: unsubscriptable object
Nov 26 22:23:38 2001 (11876) Traceback (most recent call last):
File "/work/mailman/Mailman/Queue/Runner.py", line 104, in __oneloop
self.__onefile(msg, msgdata)
File "/work/mailman/Mailman/Queue/Runner.py", line 152, in __onefile
keepqueued = self._dispose(mlist, msg, msgdata)
File "/work/mailman/Mailman/Queue/CommandRunner.py", line 61, in _dispose
mlist.ParseMailCommands(msg, msgdata)
File "/work/mailman/Mailman/MailCommandHandler.py", line 184, in
ParseMailCommands
lines = email.Iterators.body_line_iterator(msg)[:]
TypeError: unsubscriptable object
this happened after I have clearly install python2.2b and mailman with your
patch (from cvs). I have followed instruction completely, created new list
mailman, received email about new list has been created. So I tried to send
email to mailman-request@asp.ogi.edu with "help" subject line (tried also body
of message with same result) and it created the error message above.
Thanks,
Pavel
Cituji z emailu od "Barry A. Warsaw"
Oops, forgot the patch!
-Barry
Index: MailCommandHandler.py =================================================================== RCS file: /cvsroot/mailman/mailman/Mailman/MailCommandHandler.py,v retrieving revision 2.24 diff -u -r2.24 MailCommandHandler.py --- MailCommandHandler.py 2001/11/21 17:17:35 2.24 +++ MailCommandHandler.py 2001/11/27 04:19:23 @@ -181,7 +181,7 @@ if mo: subject = mo.group('cmd')
- lines = email.Iterators.body_line_iterator(msg) + lines = email.Iterators.body_line_iterator(msg)[:]
# Find out if the subject line has a command on it subjcmd = []
Oops. Okay, let's try this one! -Barry Index: MailCommandHandler.py =================================================================== RCS file: /cvsroot/mailman/mailman/Mailman/MailCommandHandler.py,v retrieving revision 2.25 diff -u -r2.25 MailCommandHandler.py --- MailCommandHandler.py 2001/11/27 04:26:25 2.25 +++ MailCommandHandler.py 2001/11/27 07:20:00 @@ -181,7 +181,12 @@ if mo: subject = mo.group('cmd') - lines = email.Iterators.body_line_iterator(msg)[:] + # We must have a real list because of the way we insert an element and + # iterate over it. In email 0.x (pre-Python 2.2) body_line_iterator() + # returns a real list, but in email 1.x (Python 2.2), it returns a + # generator. This is the only way to coerce it to a concrete list + # object in both cases. + lines = list(email.Iterators.body_line_iterator(msg)) # Find out if the subject line has a command on it subjcmd = []
Barry,
still not there, same approache like last try:
Nov 26 23:25:30 2001 (15396) Uncaught runner exception: unsubscriptable object
Nov 26 23:25:30 2001 (15396) Traceback (most recent call last):
File "/work/mailman/Mailman/Queue/Runner.py", line 104, in __oneloop
self.__onefile(msg, msgdata)
File "/work/mailman/Mailman/Queue/Runner.py", line 152, in __onefile
keepqueued = self._dispose(mlist, msg, msgdata)
File "/work/mailman/Mailman/Queue/CommandRunner.py", line 61, in _dispose
mlist.ParseMailCommands(msg, msgdata)
File "/work/mailman/Mailman/MailCommandHandler.py", line 184, in
ParseMailCommands
lines = email.Iterators.body_line_iterator(msg)[:]
TypeError: unsubscriptable object
Thanks,
Pavel
Cituji z emailu od "Barry A. Warsaw"
Oops. Okay, let's try this one!
-Barry
Index: MailCommandHandler.py =================================================================== RCS file: /cvsroot/mailman/mailman/Mailman/MailCommandHandler.py,v retrieving revision 2.25 diff -u -r2.25 MailCommandHandler.py --- MailCommandHandler.py 2001/11/27 04:26:25 2.25 +++ MailCommandHandler.py 2001/11/27 07:20:00 @@ -181,7 +181,12 @@ if mo: subject = mo.group('cmd')
- lines = email.Iterators.body_line_iterator(msg)[:] + # We must have a real list because of the way we insert an element and + # iterate over it. In email 0.x (pre-Python 2.2) body_line_iterator() + # returns a real list, but in email 1.x (Python 2.2), it returns a + # generator. This is the only way to coerce it to a concrete list + # object in both cases. + lines = list(email.Iterators.body_line_iterator(msg))
# Find out if the subject line has a command on it subjcmd = []
"PC" == Pavel Chytil pchytil@asp.ogi.edu writes:
| lines = email.Iterators.body_line_iterator(msg)[:]
Sorry, change this line to
lines = list(email.Iterators.body_line_iterator(msg))
(You probably need to back out the previous patch first, before applying the second one I sent.)
-Barry
Man you rule!!!
At this point seems to be working fine. I will do more testing and let you know if any troubles will pop up.
Thanks a lot,
Pavel
Cituji z emailu od "Barry A. Warsaw" barry@zope.com:
"PC" == Pavel Chytil pchytil@asp.ogi.edu writes:
| lines = email.Iterators.body_line_iterator(msg)[:]
Sorry, change this line to
lines = list(email.Iterators.body_line_iterator(msg))
(You probably need to back out the previous patch first, before applying the second one I sent.)
-Barry
"PC" == Pavel Chytil pchytil@asp.ogi.edu writes:
PC> Man you rule!!!
:)
PC> At this point seems to be working fine. I will do more testing
PC> and let you know if any troubles will pop up.
PC> Thanks a lot,
No problem! Thanks for stress testing it on Python 2.2.
-Barry
I have the same problem like before. I am trying to gate my list with news. Posting to news does not work and gives following error:
Nov 27 11:12:30 2001 (18296) Uncaught runner exception: len() of unsized object Nov 27 11:12:30 2001 (18296) Traceback (most recent call last): File "/work/mailman/Mailman/Queue/Runner.py", line 104, in __oneloop self.__onefile(msg, msgdata) File "/work/mailman/Mailman/Queue/Runner.py", line 152, in __onefile keepqueued = self._dispose(mlist, msg, msgdata) File "/work/mailman/Mailman/Queue/NewsRunner.py", line 56, in _dispose prepare_message(mlist, msg, msgdata) File "/work/mailman/Mailman/Queue/NewsRunner.py", line 126, in prepare_message count = len(email.Iterators.body_line_iterator(msg)) TypeError: len() of unsized object
gating from news to list works fine, though. I am suspecting very similar problem as before.
Thanks, Pavel
This goes away if I change
count = len(email.Iterators.body_line_iterator(msg))
to
count = len(list(email.Iterators.body_line_iterator(msg)))
in ./mailman/Mailman/Queue/NewsRunner.py line 126
I do not know if this is clean or not, but I never done anything with python.
This introduce new problem which is nntp error:
Nov 27 13:48:10 2001 (26172) (NNTPDirect) NNTP error for list "test": 441 437 No colon-space in "From pchytil@asp.ogi.edu Tue Nov 27 13:48:09 2001" header
So my hacking is still in progress. I should probably read more about format of NNTP headers in documentation of mailman.
Any ideas?
Thanks, Pavel
Cituji z emailu od Pavel Chytil pchytil@ece.ogi.edu:
I have the same problem like before. I am trying to gate my list with news. Posting to news does not work and gives following error:
Nov 27 11:12:30 2001 (18296) Uncaught runner exception: len() of unsized object Nov 27 11:12:30 2001 (18296) Traceback (most recent call last): File "/work/mailman/Mailman/Queue/Runner.py", line 104, in __oneloop self.__onefile(msg, msgdata) File "/work/mailman/Mailman/Queue/Runner.py", line 152, in __onefile keepqueued = self._dispose(mlist, msg, msgdata) File "/work/mailman/Mailman/Queue/NewsRunner.py", line 56, in _dispose prepare_message(mlist, msg, msgdata) File "/work/mailman/Mailman/Queue/NewsRunner.py", line 126, in prepare_message count = len(email.Iterators.body_line_iterator(msg)) TypeError: len() of unsized object
gating from news to list works fine, though. I am suspecting very similar problem as before.
Thanks, Pavel
Mailman-Developers mailing list Mailman-Developers@python.org http://mail.python.org/mailman/listinfo/mailman-developers
Patch:
--- NewsRunner.py Tue Nov 27 13:22:45 2001
+++ NewsRunner.py Thu Oct 11 22:16:18 2001
@@ -123,7 +123,7 @@
# Lines: is useful
if msg['Lines'] is None:
# BAW: is there a better way?
- count = len(list(email.Iterators.body_line_iterator(msg)))
+ count = len(email.Iterators.body_line_iterator(msg))
msg['Lines'] = str(count)
# Massage the message headers by remove some and rewriting others. This
# woon't completely sanitize the message, but it will eliminate the bulk
Pavel
Cituji z emailu od Pavel Chytil
This goes away if I change
count = len(email.Iterators.body_line_iterator(msg))
to
count = len(list(email.Iterators.body_line_iterator(msg)))
in ./mailman/Mailman/Queue/NewsRunner.py line 126
I do not know if this is clean or not, but I never done anything with python.
This introduce new problem which is nntp error:
Nov 27 13:48:10 2001 (26172) (NNTPDirect) NNTP error for list "test": 441 437 No colon-space in "From pchytil@asp.ogi.edu Tue Nov 27 13:48:09 2001" header
So my hacking is still in progress. I should probably read more about format of NNTP headers in documentation of mailman.
Any ideas?
Thanks, Pavel
Cituji z emailu od Pavel Chytil
: I have the same problem like before. I am trying to gate my list with news. Posting to news does not work and gives following error:
Nov 27 11:12:30 2001 (18296) Uncaught runner exception: len() of unsized object Nov 27 11:12:30 2001 (18296) Traceback (most recent call last): File "/work/mailman/Mailman/Queue/Runner.py", line 104, in __oneloop self.__onefile(msg, msgdata) File "/work/mailman/Mailman/Queue/Runner.py", line 152, in __onefile keepqueued = self._dispose(mlist, msg, msgdata) File "/work/mailman/Mailman/Queue/NewsRunner.py", line 56, in _dispose prepare_message(mlist, msg, msgdata) File "/work/mailman/Mailman/Queue/NewsRunner.py", line 126, in prepare_message count = len(email.Iterators.body_line_iterator(msg)) TypeError: len() of unsized object
gating from news to list works fine, though. I am suspecting very similar problem as before.
Thanks, Pavel
_______________________________________________ Mailman-Developers mailing list Mailman-Developers@python.org http://mail.python.org/mailman/listinfo/mailman-developers
_______________________________________________ Mailman-Developers mailing list Mailman-Developers@python.org http://mail.python.org/mailman/listinfo/mailman-developers
participants (5)
-
barry@zope.com
-
Bob Puff@NLE
-
Pavel Chytil
-
Pavel Chytil
-
Pavel Chytil