[Tutor] lxml.html

nitin chandra nitinchandra1 at gmail.com
Wed Jun 8 17:20:12 CEST 2011


Hello Every One,

         doc = lxml.html.parse('/home/dev/wsgi-scripts/index.py').getroot()
         name = doc.forms[0].fields['name']

         html = 'name is '
         html += name

ERROR
[Wed Jun 08 20:29:51 2011] [error] [client 192.168.1.9] Traceback
(most recent call last):
[Wed Jun 08 20:29:51 2011] [error] [client 192.168.1.9]   File
"/home/dev/wsgi-scripts/response.py", line 33, in application
[Wed Jun 08 20:29:51 2011] [error] [client 192.168.1.9]     return
handler.do(environ, start_response)
[Wed Jun 08 20:29:51 2011] [error] [client 192.168.1.9]   File
"/home/dev/wsgi-scripts/response.py", line 15, in do
[Wed Jun 08 20:29:51 2011] [error] [client 192.168.1.9]     html += name
[Wed Jun 08 20:29:51 2011] [error] [client 192.168.1.9] TypeError:
cannot concatenate 'str' and 'NoneType' objects


I am extracting form field name / value from an html, but then it
gives the above error and does
not display the value of the variable 'name' entered in the respective form.

Thank

Nitin


More information about the Tutor mailing list