I am trying to write into a file (in Python), but it says:
‘ManyRelatedManager’ object has no attribute ‘encode’
Here is the code:
self.writer.writerow([s.encode('utf-8') for s in row])
Is there a way to avoid/fix this ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
in your code
the “s” object may not a unicode object
you should try change your “s” object to unicode first