UnicodeEncodeError: ‘ascii’ codec can’t encode character u’\u201c’ in position 34: ordinal not in range(128)

q.title is a Unicode string. When writing that to a file, you need to encode it first, preferably a fully Unicode-capable encoding such as UTF-8 (if you don’t, Python will default to using the ASCII codec which doesn’t support any character codepoint above 127). question.write(q.title.encode(“utf-8”)) should fix the problem. By the way, the program tripped … Read more