AttributeError: 'generator' object has no attribute 'pop' (was: Re: [Mailman-Developers] Uncaught runner exception: 'generator' object has no attribute 'insert')
Markus Jansen
Markus Jansen <Markus.Jansen@pac.ericsson.se>
Wed, 28 Nov 2001 17:56:57 +0100 (MET)
Hi Pavel,
I have seen the same problem in Tagger.py (see context diff below)
with incoming mails.
Similar to you, I have some 2 days of Python experience, but it seems to=20
work now.
Best regards,
=09Markus
> diff -c Tagger.py.orig Tagger.py
*** Tagger.py.orig Wed Nov 28 17:50:36 2001
--- Tagger.py Wed Nov 28 17:55:09 2001
***************
*** 81,87 ****
# the first numlines of body text.
lines =3D []
lineno =3D 0
! reader =3D email.Iterators.body_line_iterator(msg)
while numlines is None or lineno < numlines:
try:
line =3D reader.pop(0)
--- 81,87 ----
# the first numlines of body text.
lines =3D []
lineno =3D 0
! reader =3D list(email.Iterators.body_line_iterator(msg))
while numlines is None or lineno < numlines:
try:
line =3D reader.pop(0)
>=20
> X-Authentication-Warning: asp.ogi.edu: nobody set sender to paja@asp.ogi.=
edu=20
using -f
> From: Pavel Chytil <paja@asp.ogi.edu>
> To: "Barry A. Warsaw" <barry@zope.com>
> Cc: mailman-developers@python.org
> Subject: Re: [Mailman-Developers] Uncaught runner exception: 'generator'=
=20
object has no attribute 'insert'
> MIME-Version: 1.0
> Content-Transfer-Encoding: 8bit
> User-Agent: Internet Messaging Program (IMP) 4.0-cvs
> X-BeenThere: mailman-developers@python.org
> X-Mailman-Version: 2.0.7 (101270)
> List-Help: <mailto:mailman-developers-request@python.org?subject=3Dhelp>
> List-Post: <mailto:mailman-developers@python.org>
> List-Subscribe: <http://mail.python.org/mailman/listinfo/mailman-develope=
rs>,=20
<mailto:mailman-developers-request@python.org?subject=3Dsubscribe>
> List-Id: Mailman mailing list developers <mailman-developers.python.org>
> List-Unsubscribe:=20
<http://mail.python.org/mailman/listinfo/mailman-developers>,=20
<mailto:mailman-developers-request@python.org?subject=3Dunsubscribe>
> List-Archive: <http://mail.python.org/pipermail/mailman-developers/>
> Date: Tue, 27 Nov 2001 14:03:42 -0800
>=20
> Patch:
>=20
> --- 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 =3D len(list(email.Iterators.body_line_iterator(msg)))
> + count =3D len(email.Iterators.body_line_iterator(msg))
> msg['Lines'] =3D 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
>=20
> Pavel
>=20
> Cituji z emailu od Pavel Chytil <pchytil@asp.ogi.edu>:
>=20
> > This goes away if I change
> >=20
> > count =3D len(email.Iterators.body_line_iterator(msg))
> >=20
> > to
> >=20
> > count =3D len(list(email.Iterators.body_line_iterator(msg)))
> >=20
> > in ./mailman/Mailman/Queue/NewsRunner.py line 126
> >=20
> > I do not know if this is clean or not, but I never done anything with
> > python.
> >=20
> > This introduce new problem which is nntp error:
> >=20
> > Nov 27 13:48:10 2001 (26172) (NNTPDirect) NNTP error for list "test": 4=
41=20
437
> > No
> > colon-space in "From pchytil@asp.ogi.edu Tue Nov 27 13:48:09 2001" head=
er
> >=20
> > So my hacking is still in progress. I should probably read more about f=
ormat
> > of
> > NNTP headers in documentation of mailman.
> >=20
> > Any ideas?
> >=20
> > Thanks,
> > =09Pavel
> >=20
> > Cituji z emailu od Pavel Chytil <pchytil@ece.ogi.edu>:
> >=20
> > > 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:
> > >=20
> > > Nov 27 11:12:30 2001 (18296) Uncaught runner exception: len() of unsi=
zed
> > > object
> > > Nov 27 11:12:30 2001 (18296) Traceback (most recent call last):
> > > File "/work/mailman/Mailman/Queue/Runner.py", line 104, in __oneloo=
p
> > > self.__onefile(msg, msgdata)
> > > File "/work/mailman/Mailman/Queue/Runner.py", line 152, in __onefil=
e
> > > keepqueued =3D self._dispose(mlist, msg, msgdata)
> > > File "/work/mailman/Mailman/Queue/NewsRunner.py", line 56, in _disp=
ose
> > > prepare_message(mlist, msg, msgdata)
> > > File "/work/mailman/Mailman/Queue/NewsRunner.py", line 126, in
> > > prepare_message
> > > count =3D len(email.Iterators.body_line_iterator(msg))
> > > TypeError: len() of unsized object
> > >=20
> > > gating from news to list works fine, though. I am suspecting very sim=
ilar
> > > problem as before.
> > >=20
> > > Thanks,
> > > =09Pavel
> > >=20
> > > _______________________________________________
> > > Mailman-Developers mailing list
> > > Mailman-Developers@python.org
> > > http://mail.python.org/mailman/listinfo/mailman-developers
> > >=20
> >=20
> >=20
> >=20
> > _______________________________________________
> > Mailman-Developers mailing list
> > Mailman-Developers@python.org
> > http://mail.python.org/mailman/listinfo/mailman-developers
> >=20
>=20
>=20
>=20
> _______________________________________________
> Mailman-Developers mailing list
> Mailman-Developers@python.org
> http://mail.python.org/mailman/listinfo/mailman-developers
--
Markus Jansen Markus.Jansen@ericsson.com
Senior Designer, Technical Coordinator
Ericsson Process & Application Consulting
TTM Solutions / CM Tools VH/PAC/L/TD Phone +46 8 568 61560
V=E4stberga All=E9 36A Mobile +46 70 526 2548
12582 Stockholm, Sweden Fax +46 8 568 61888