Re: TypeError: iterable argument required
On 5 Απρ, 05:49, eryksun () eryk...@gmail.com wrote: On Monday, April 4, 2011 9:40:33 AM UTC-4, Νικόλαος Κούρας wrote: In one of your messages you wrote the following: 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]) ) Is this a typo in your message or the actual code? If 'e' is unassigned you should be getting a NameError. The standard Python2 syntax (before version 2.6) is the following: except MySQLdb.Error, e: print(Error %d: %s % (e.args[0], e.args[1])) You also wrote: mail = None, comment = None This should cause a SyntaxError because it's trying to assign None = None. That's assuming it's on line 167, after the cursor.execute(...) on line 166. Whats was the problem as i have written it? Your solution is the same as mine except the fact that you assign values and statements into variables. I was just rewriting it to make sure I was parsing it right. I tried it but iam getting an Internal Server Error. Also i noticed that if i append a query string in the end of a url with the varibble mail attached like http://superhost.gr/hosting.html?mail=test then page hosting.html does load without any problem. If i remove the query string from the ned of the URL then i'am getting the error message i posted. So its not that the if condition is wrong but something happens with the form variable 'mail' . Insert a test to print out the type and value of 'mail' for various inputs. Regarding the message itself, on Python 2.7.1, I get the following TypeError message if I try iterate None: TypeError: argument of type 'NoneType' is not iterable Python 2.5.2 on http://shell.appspot.com; yields the same error. Version 2.5 improved the error messages to include the type of the object (see issue 1507676). The message iterable argument required looks like an older version of CPython. Thank you you were right. The trouble was in `if @ in mail` . You can only test somthing `in` something else if the second thing is iterable and None isnt. So i made the code look like this: [code] if ( mail is not None and '@' in mail ) and comment not in (Ρωτήστε με σχετικά..., , None): [/code] Now it works like i wanted but i want to ask you if i wrote it correctly, especially when i check against `` and None And please explain to me the difference betweeen an empty string `` and None. An empty string is still a string with zero characters within? Yes, I made a mistake. It should have been `cursor.execute(SQL_COMMENT_FORM, (mail, comment))`, using a comma instead of a '%' to have it generate SQL string literals from the tuple. What do you mean by to have it generate SQL string literals from the tuple. Please explain -- http://mail.python.org/mailman/listinfo/python-list
Re: TypeError: iterable argument required
On Wednesday, April 6, 2011 6:06:06 AM UTC-4, Νικόλαος Κούρας wrote: The trouble was in `if @ in mail` . You can only test somthing `in` something else if the second thing is iterable and None isnt. So i made the code look like this: [code] if ( mail is not None and '@' in mail ) and comment not in (Ρωτήστε με σχετικά..., , None): [/code] Now it works like i wanted but i want to ask you if i wrote it correctly, especially when i check against `` and None You can also use an empty string as the default value when getting the field value, which would simplify your test by eliminating None as a possibility. The particulars will depend on your framework. For example, cgi.FieldStorage has a getfirst method that takes a default value as the 2nd parameter. Also, a simple OR statement can eliminate the None. For example: mail = mail or ''. Since None is False, the statement returns the right-hand operand, which is an empty string ''. And please explain to me the difference betweeen an empty string `` and None. An empty string is still a string with zero characters within? Yes, an empty string is still of type 'str'. None is Python's null value of type 'NoneType'. Its boolean value is False, and it does nothing special and cannot be subclassed. When a function doesn't explicitly return a value, it implicitly returns None. Yes, I made a mistake. It should have been `cursor.execute(SQL_COMMENT_FORM, (mail, comment))`, using a comma instead of a '%' to have it generate SQL string literals from the tuple. What do you mean by to have it generate SQL string literals from the tuple. Please explain Here's an amusing warning from the Psycopg (PostgreSQL) docs: Warning: Never, never, NEVER use Python string concatenation (+) or string parameters interpolation (%) to pass variables to a SQL query string. Not even at gunpoint. The line I wrote not only didn't properly quote or escape the data values, but it probably also broke the protection from a SQL injection attack. Always list the data in the 2nd parameter as a tuple. -- http://mail.python.org/mailman/listinfo/python-list
Re: TypeError: iterable argument required
On 6 Απρ, 16:54, eryksun () eryk...@gmail.com wrote: You can also use an empty string as the default value when getting the field value Please provide me an example. Also, a simple OR statement can eliminate the None. For example: mail = mail or ''. Since None is False, the statement returns the right-hand operand, which is an empty string ''. mail = None mail mail = mail or '' mail '' Why in 2nd case the returned value of mail is None. Why shouldn't it be the empty string since mail = None which is false. How exactly Python parses those two statements in english words? mail = None mail mail = '' or mail mail The line I wrote not only didn't properly quote or escape the data values, but it probably also broke the protection from a SQL injection attack. Always list the data in the 2nd parameter as a tuple. Can you please also provide an example of what happens if i use the special formatting identidier `%` instead of a comma? -- http://mail.python.org/mailman/listinfo/python-list
Re: TypeError: iterable argument required
mail = None mail = mail or 7 mail 7 mail = None mail = 7 or mail mail 7 Here no matter the order iam writing the comparison it always return the number. why not the same here? mail = None mail = mail or '' mail '' mail = None mail = '' or mail mail Why the or operator behaves differently with numbers than from strings? Please explain to me how it parses it with words. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
Re: TypeError: iterable argument required
On 06/04/2011 16:57, Νικόλαος Κούρας wrote: mail = None mail = mail or 7 mail 7 mail = None mail = 7 or mail mail 7 Here no matter the order iam writing the comparison it always return the number. why not the same here? mail = None mail = mail or '' mail '' mail = None mail = '' or mail mail Why the or operator behaves differently with numbers than from strings? Please explain to me how it parses it with words. Thank you. See this for an explanation of Python truth value testing. http://docs.python.org/library/stdtypes.html Cheers. Mark L. -- http://mail.python.org/mailman/listinfo/python-list
Re: TypeError: iterable argument required
Hi, The or expression will return the first element that evaluates to True, or the last element if they all evaluate to False. Positive integers evaluate to True. None evaluates to False. See: http://docs.python.org/library/stdtypes.html#truth-value-testing http://docs.python.org/library/stdtypes.html#truth-value-testing-eric 2011/4/6 Νικόλαος Κούρας nikos.kou...@gmail.com mail = None mail = mail or 7 mail 7 mail = None mail = 7 or mail mail 7 Here no matter the order iam writing the comparison it always return the number. why not the same here? mail = None mail = mail or '' mail '' mail = None mail = '' or mail mail Why the or operator behaves differently with numbers than from strings? Please explain to me how it parses it with words. Thank you. -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: TypeError: iterable argument required
On Wednesday, April 6, 2011 11:41:24 AM UTC-4, Νικόλαος Κούρας wrote: On 6 Απρ, 16:54, eryksun () ery...@gmail.com wrote: You can also use an empty string as the default value when getting the field value Please provide me an example. import cgi form = cgi.FieldStorage() user = form.getfirst(user, ) Here's the relevant section of the cgi docs: http://docs.python.org/library/cgi.html#higher-level-interface But it depends on your set up. Are you using mod_wsgi, mod_python, etc? Will you be using a framework such as Django or web2py? Can you please also provide an example of what happens if i use the special formatting identidier `%` instead of a comma? All of the formatting for adding extra quotes and escaping special characters can be done with normal string formatting (which I neglected to do). But that's not counting the most important reason to let the database handle the operation: the potential for an attacker to inject SQL commands into form values (e.g., to drop all of your tables). So let the database handle formatting the strings and escaping any SQL statements contained therein. -- http://mail.python.org/mailman/listinfo/python-list
Re: TypeError: iterable argument required
On Wednesday, April 6, 2011 11:57:32 AM UTC-4, Νικόλαος Κούρας wrote: mail = None mail = mail or 7 mail 7 Quote: The expression ``x or y`` first evaluates *x*; if *x* is true, its value is returned; otherwise, *y* is evaluated and the resulting value is returned. Since 'mail is None' and None evaluates to False, the operation returns the right-hand operand, 7. mail = None mail = 7 or mail mail 7 Here no matter the order iam writing the comparison it always return the number. In this case the number 7 evaluates to True. why not the same here? mail = None mail = mail or '' mail '' mail = None mail = '' or mail mail Why the or operator behaves differently with numbers than from strings? It's behaving the same. You're overlooking the fact that the empty string is False: In [1]: bool('') Out[1]: False Length zero sequences are normally False, but you can override this in a subclass by implementing the __nonzero__ method: In [2]: class mystr(str): ...: def __nonzero__(self): ...: return True In [3]: bool(mystr('')) Out[3]: True -- http://mail.python.org/mailman/listinfo/python-list
Re: TypeError: iterable argument required
On 4/6/2011 6:06 AM, Νικόλαος Κούρας wrote: Now it works like i wanted but i want to ask you if i wrote it correctly, especially when i check against `` and None One important note: there is one and one one None object; there can be multiple strings with value ''. So, testing against each is different: a is None; a is not None a == ''; a != '' -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: TypeError: iterable argument required
On 6 Απρ, 19:58, eryksun () eryk...@gmail.com wrote: The expression ``x or y`` first evaluates *x*; if *x* is true, its value is returned; otherwise, *y* is evaluated and the resulting value is returned. I doesnt matter if *y* is True or False before its value is returned? *y*'s value returned no matter if its true or false? If we were to describe it in english words how would we describe the expression `x or y`? x = True or y = True? Since 'mail is None' and None evaluates to False What does the expression None evaluates to false mean in simpler words? Every expression is evaluated at the end as True or False? -- http://mail.python.org/mailman/listinfo/python-list
Re: TypeError: iterable argument required
On 06/04/2011 20:21, Νικόλαος Κούρας wrote: On 6 Απρ, 19:58, eryksun ()eryk...@gmail.com wrote: The expression ``x or y`` first evaluates *x*; if *x* is true, its value is returned; otherwise, *y* is evaluated and the resulting value is returned. I doesnt matter if *y* is True or False before its value is returned? *y*'s value returned no matter if its true or false? If we were to describe it in english words how would we describe the expression `x or y`? x = True or y = True? Since 'mail is None' and None evaluates to False What does the expression None evaluates to false mean in simpler words? Every expression is evaluated at the end as True or False? For `x or y`, if `bool(x)` is True, it returns `x`, else it returns `y`. For `x or y or z`, if `bool(x)` is True, it returns `x`, else if `bool(y)` is True, it returns `y`, else it returns `z`. And so on. In Python, the convention is for certain things to be regarded as False (bool(thing) returns False) and everything else to be regarded as True (bool(thing) returns True). 'False' things include None, empty strings, empty containers (empty list, etc), and zero. 'True' things include non-empty strings, non-empty containers, and non-zero numbers. When in doubt, ask Python: bool([]) False bool(Hello world!) True -- http://mail.python.org/mailman/listinfo/python-list
Re: TypeError: iterable argument required
On Wednesday, April 6, 2011 3:21:42 PM UTC-4, Νικόλαος Κούρας wrote: On 6 Απρ, 19:58, eryksun () ery...@gmail.com wrote: The expression ``x or y`` first evaluates *x*; if *x* is true, its value is returned; otherwise, *y* is evaluated and the resulting value is returned. I doesnt matter if *y* is True or False before its value is returned? *y*'s value returned no matter if its true or false? In general *y* is an expression that gets evaluated down to some object that gets returned: In [1]: type(False or (3-3)) Out[1]: type 'int' In this case the int equals 0, which is False in a boolean context: In [2]: bool(False or (3-3)) Out[2]: False Since 'mail is None' and None evaluates to False What does the expression None evaluates to false mean in simpler words? Every expression is evaluated at the end as True or False? It means bool(None) is False. In (x or y), the expression y will only be evaluated if bool(x) is False. If bool(x) evaluates to True, then the operation short circuits to return x without evaluating y. -- http://mail.python.org/mailman/listinfo/python-list
Re: TypeError: iterable argument required
On 3 Απρ, 17:01, eryksun () eryk...@gmail.com wrote: On Saturday, April 2, 2011 12:26:18 PM UTC-4, Νικόλαος Κούρας 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',) Here's how I parse what you've written so far: INVALID_COMMENTS = (Σχολιάστε ή ρωτήστεμε σχετικά, ) SQL_COMMENT_FORM = INSERT INTO users(mail, comment) VALUES(%s, %s) # insert guest comments into database if form was submitted mail = form.getvalue('mail') comment = form.getvalue('comment') if @ in mail and comment not in INVALID_COMMENTS: try: cursor.execute(SQL_COMMENT_FORM % (mail, comment)) except MySQLdb.Error as e: print(Error %d: %s % (e.args[0], e.args[1])) else: mail = comment = None Whats was the problem as i have written it? Your solution is the same as mine except the fact that you assign values and statements into variables. I tried it but iam getting an Internal Server Error. In my original question can you explain to me what the meaning of the following error is? mail = None, comment = None TypeError: iterable argument required args = ('iterable argument required',) * Also i noticed that if i append a query string in the end of a url with the varibble mail attached like http://superhost.gr/hosting.html?mail=test then page hosting.html does load without any problem. If i remove the query string from the ned of the URL then i'am getting the error message i posted. So its not that the if condition is wrong but something happens with the form variable 'mail' . -- http://mail.python.org/mailman/listinfo/python-list
Re: TypeError: iterable argument required
Νικόλαος Κούρας wrote: if @ in mail and comment not in INVALID_COMMENTS: In my original question can you explain to me what the meaning of the following error is? mail = None, comment = None TypeError: iterable argument required args = ('iterable argument required',) * That's not the standard format for a traceback in Python and you don't provide enough context like: - your python version - the framework that produces the non-standard traceback - a significant portion of your code That makes it harder than necessary to find out what's going on. Python 2.4.6 (#2, Jan 21 2010, 23:45:25) [GCC 4.4.1] on linux2 Type help, copyright, credits or license for more information. @ in None Traceback (most recent call last): File stdin, line 1, in ? TypeError: iterable argument required So mail = None means exactly that, you somehow assigned None to the mail variable. Note that newer Python versions give a slightly improved error message: $ python2.5 -c '@ in None' Traceback (most recent call last): File string, line 1, in module TypeError: argument of type 'NoneType' is not iterable Background: the 'in' operator tries hard to produce a meaningful result before it gives up: class A: ... def __getattr__(self, name): ... print name ... raise AttributeError ... 42 in A() __contains__ __iter__ __getitem__ Traceback (most recent call last): File stdin, line 1, in module TypeError: argument of type 'instance' is not iterable -- http://mail.python.org/mailman/listinfo/python-list
Re: TypeError: iterable argument required
Νικόλαος Κούρας wrote: 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',) In my original question can you explain to me what the meaning of the following error is? mail = None, comment = None TypeError: iterable argument required args = ('iterable argument required',) * Also i noticed that if i append a query string in the end of a url with the varibble mail attached like http://superhost.gr/hosting.html?mail=test then page hosting.html does load without any problem. If i remove the query string from the ned of the URL then i'am getting the error message i posted. So its not that the if condition is wrong but something happens with the form variable 'mail' . My wild guess is that the trouble is in `if @ in mail` . You can only test somthing `in` something if the second thing is iterable. So when you don't supply a value via `?mail=' -- maybe the code that sets the value of `mail` from the URL (code you don't show us) sets `mail=None`, your server-side code blows up. Things would be simpler if you included a traceback in your error logging. Mel. -- http://mail.python.org/mailman/listinfo/python-list
Re: TypeError: iterable argument required
On 4 Απρ, 17:38, Mel mwil...@the-wire.com wrote: Íéêüëáïò Êïýñáò wrote: 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',) In my original question can you explain to me what the meaning of the following error is? mail = None, comment = None TypeError: iterable argument required args = ('iterable argument required',) * Also i noticed that if i append a query string in the end of a url with the varibble mail attached like http://superhost.gr/hosting.html?mail=test then page hosting.html does load without any problem. If i remove the query string from the ned of the URL then i'am getting the error message i posted. So its not that the if condition is wrong but something happens with the form variable 'mail' . My wild guess is that the trouble is in `if @ in mail` . You can only test somthing `in` something if the second thing is iterable. So when you don't supply a value via `?mail=' -- maybe the code that sets the value of `mail` from the URL (code you don't show us) sets `mail=None`, your server-side code blows up. Things would be simpler if you included a traceback in your error logging. Mel. I think you and Peter are right. Somehow mail variable which is taken its value from a form field is assigned a None value. Here is the hosting.html part of the code that include the form variable mail form method=post action= input type=text name=mail value=Ποιό είναι το email σου?br textarea name=comment cols=40 rows=5 Σχολιάστε ή ρωτήστε με σχετικά /textareabr input type=hidden name=page value=hosting.html input type=submit value=Ρώτα /form But as you can see it has a default value of Ποιό είναι το email σου? So how can be of a NoneType ? Things would be simpler if you included a traceback in your error logging. You mean the web server's last error log messages for the error.log file? -- http://mail.python.org/mailman/listinfo/python-list
Re: TypeError: iterable argument required
On Monday, April 4, 2011 9:40:33 AM UTC-4, Νικόλαος Κούρας wrote: In one of your messages you wrote the following: 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]) ) Is this a typo in your message or the actual code? If 'e' is unassigned you should be getting a NameError. The standard Python2 syntax (before version 2.6) is the following: except MySQLdb.Error, e: print(Error %d: %s % (e.args[0], e.args[1])) You also wrote: mail = None, comment = None This should cause a SyntaxError because it's trying to assign None = None. That's assuming it's on line 167, after the cursor.execute(...) on line 166. Whats was the problem as i have written it? Your solution is the same as mine except the fact that you assign values and statements into variables. I was just rewriting it to make sure I was parsing it right. I tried it but iam getting an Internal Server Error. Yes, I made a mistake. It should have been `cursor.execute(SQL_COMMENT_FORM, (mail, comment))`, using a comma instead of a '%' to have it generate SQL string literals from the tuple. Also i noticed that if i append a query string in the end of a url with the varibble mail attached like http://superhost.gr/hosting.html?mail=test then page hosting.html does load without any problem. If i remove the query string from the ned of the URL then i'am getting the error message i posted. So its not that the if condition is wrong but something happens with the form variable 'mail' . Insert a test to print out the type and value of 'mail' for various inputs. Regarding the message itself, on Python 2.7.1, I get the following TypeError message if I try iterate None: TypeError: argument of type 'NoneType' is not iterable Python 2.5.2 on http://shell.appspot.com; yields the same error. Version 2.5 improved the error messages to include the type of the object (see issue 1507676). The message iterable argument required looks like an older version of CPython. -- http://mail.python.org/mailman/listinfo/python-list
Re: TypeError: iterable argument required
On Saturday, April 2, 2011 12:26:18 PM UTC-4, Νικόλαος Κούρας 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',) Here's how I parse what you've written so far: INVALID_COMMENTS = (Σχολιάστε ή ρωτήστεμε σχετικά, ) SQL_COMMENT_FORM = INSERT INTO users(mail, comment) VALUES(%s, %s) # insert guest comments into database if form was submitted mail = form.getvalue('mail') comment = form.getvalue('comment') if @ in mail and comment not in INVALID_COMMENTS: try: cursor.execute(SQL_COMMENT_FORM % (mail, comment)) except MySQLdb.Error as e: print(Error %d: %s % (e.args[0], e.args[1])) else: mail = comment = None -- http://mail.python.org/mailman/listinfo/python-list
TypeError: iterable argument required
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? -- http://mail.python.org/mailman/listinfo/python-list
Re: TypeError: iterable argument required
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. -- http://mail.python.org/mailman/listinfo/python-list
Re: TypeError: iterable argument required
2011/4/3 MRAB pyt...@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 -- http://mail.python.org/mailman/listinfo/python-list
Re: TypeError: iterable argument required
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') -- http://mail.python.org/mailman/listinfo/python-list