X Attribute Error Nonetype Object Has No Attribute Encode

X Attribute Error Nonetype Object Has No Attribute Encode