Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #2459 > unrolled thread

TypeError: iterable argument required

Started byΝικόλαος Κούρας <nikos.kouras@gmail.com>
First post2011-04-02 09:26 -0700
Last post2011-04-03 05:31 +1000
Articles 4 — 3 participants

Back to article view | Back to comp.lang.python


Contents

  TypeError: iterable argument required Νικόλαος Κούρας <nikos.kouras@gmail.com> - 2011-04-02 09:26 -0700
    Re: TypeError: iterable argument required MRAB <python@mrabarnett.plus.com> - 2011-04-02 17:50 +0100
      Re: TypeError: iterable argument required Νικόλαος Κούρας <nikos.kouras@gmail.com> - 2011-04-02 14:02 -0700
    Re: TypeError: iterable argument required Chris Angelico <rosuav@gmail.com> - 2011-04-03 05:31 +1000

#2459 — TypeError: iterable argument required

FromΝικόλαος Κούρας <nikos.kouras@gmail.com>
Date2011-04-02 09:26 -0700
SubjectTypeError: iterable argument required
Message-ID<3902dc1f-90bb-4602-9938-402a3582aa84@v31g2000vbs.googlegroups.com>
Hello, after inserting this line if "@" in mail and comment not in
("Σχολιάστε ή ρωτήστε με σχετικά....", ""):

iam getting the following error which i dont understand

**************************************************************
163         # insert guest comments into database if form was
submitted
  164         if "@" in mail and comment not in ("Σχολιάστε ή ρωτήστε
με σχετικά....", ""):
  165                 try:
  166                         cursor.execute( '''INSERT INTO
users(mail, comment) VALUES(%s, %s)''', (mail, comment) )
mail = None, comment = None

TypeError: iterable argument required
      args = ('iterable argument required',)
**************************************************************

can you help please?

[toc] | [next] | [standalone]


#2462

FromMRAB <python@mrabarnett.plus.com>
Date2011-04-02 17:50 +0100
Message-ID<mailman.130.1301763047.2990.python-list@python.org>
In reply to#2459
On 02/04/2011 17:26, Νικόλαος Κούρας wrote:
> Hello, after inserting this line if "@" in mail and comment not in
> ("Σχολιάστε ή ρωτήστε με σχετικά....", ""):
>
> iam getting the following error which i dont understand
>
> **************************************************************
> 163         # insert guest comments into database if form was
> submitted
>    164         if "@" in mail and comment not in ("Σχολιάστε ή ρωτήστε
> με σχετικά....", ""):
>    165                 try:
>    166                         cursor.execute( '''INSERT INTO
> users(mail, comment) VALUES(%s, %s)''', (mail, comment) )
> mail = None, comment = None
>
> TypeError: iterable argument required
>        args = ('iterable argument required',)
> **************************************************************
>
> can you help please?

Which version of Python?

Can you please paste those few lines of code (say, lines 163 to 170).

I can't see what the "mail = None, comment = None" is meant to be.

[toc] | [prev] | [next] | [standalone]


#2470

FromΝικόλαος Κούρας <nikos.kouras@gmail.com>
Date2011-04-02 14:02 -0700
Message-ID<e638f3a5-6098-4231-b20f-aa9c72917c8b@32g2000vbe.googlegroups.com>
In reply to#2462
On 2 Απρ, 19:50, MRAB <pyt...@mrabarnett.plus.com> wrote:
> On 02/04/2011 17:26, Íéêüëáïò Êïýñáò wrote:
>
>
>
>
>
>
>
>
>
> > Hello, after inserting this line if "@" in mail and comment not in
> > ("Ó÷ïëéÜóôå Þ ñùôÞóôå ìå ó÷åôéêÜ....", ""):
>
> > iam getting the following error which i dont understand
>
> > **************************************************************
> > 163         # insert guest comments into database if form was
> > submitted
> >    164         if "@" in mail and comment not in ("Ó÷ïëéÜóôå Þ ñùôÞóôå
> > ìå ó÷åôéêÜ....", ""):
> >    165                 try:
> >    166                         cursor.execute( '''INSERT INTO
> > users(mail, comment) VALUES(%s, %s)''', (mail, comment) )
> > mail = None, comment = None
>
> > TypeError: iterable argument required
> >        args = ('iterable argument required',)
> > **************************************************************
>
> > can you help please?
>
> Which version of Python?
>
> Can you please paste those few lines of code (say, lines 163 to 170).
>
> I can't see what the "mail = None, comment = None" is meant to be.

Is the same lines i posted in the 1st post

**************************************************************
	# insert guest comments into database if form was submitted
	if "@" in mail and comment not in ("Σχολιάστε ή ρωτήστε με
σχετικά....", ""):
		try:
			cursor.execute( '''INSERT INTO users(mail, comment) VALUES(%s,
%s)''', (mail, comment) )
		except MySQLdb.Error:
			print ( "Error %d: %s" % (e.args[0], e.args[1]) )
**************************************************************

Also both mail and comment variables are taken from input in form
fields.

mail = form.getvalue('mail')
comment = form.getvalue('comment')

[toc] | [prev] | [next] | [standalone]


#2467

FromChris Angelico <rosuav@gmail.com>
Date2011-04-03 05:31 +1000
Message-ID<mailman.136.1301772697.2990.python-list@python.org>
In reply to#2459
2011/4/3 MRAB <python@mrabarnett.plus.com>:
> I can't see what the "mail = None, comment = None" is meant to be.

If this is to reset the two variables after inserting into the
database, you may want to use either:

mail = None; comment = None  # semicolon not comma
or
mail = comment = None  # chaining assignment

Is that the line with the error, though?

Chris Angelico

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web