[Tutor] lxml.html

Steven D'Aprano steve at pearwood.info
Thu Jun 9 02:54:10 CEST 2011


nitin chandra wrote to me off-list. I've taken the liberty of returning 
the conversation to the mailing list.

> Hi,
> 
>>> ERROR
>>> [Wed Jun 08 20:29:51 2011] [error] [client 192.168.1.9] Traceback
>>> (most recent call last):
>> What is all this extraneous date/error/ip address nonsense in the traceback?
>> Where does it come from?
> 
> This error statement comes from Apache Error Logs. Python / WSGI / apache.

In future, please strip that extraneous noise before posting, thank you.


>>> 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.
>> What is the value of the variable 'name'?
> 
> Value entered in the form is 'admin'

I didn't ask what the value entered in the form is. Where does the form 
go? Where are you looking? Are you sure you're looking in the right place?

You're looking at a file /home/dev/wsgi-scripts/index.py and trying to 
extract XML from that file. What's inside that file?


>> Hint: read the error message that you get when you try to concatenate a
>> string with the None object:
>>>>> "spam" + None
>> Traceback (most recent call last):
>>  File "<stdin>", line 1, in <module>
>> TypeError: cannot concatenate 'str' and 'NoneType' objects
> 
> 
> Did this.... gives the same error... now the question is how do i NOT
> face the same error.?

By making sure that the variable name actually contains a name.



-- 
Steven



More information about the Tutor mailing list