nitebyte / TripTeller

31 stars 8 forks source link

Error: #4

Open playhousehosting opened 1 year ago

playhousehosting commented 1 year ago

Can you assist with this error?

Traceback (most recent call last): File "C:\Users\Owner\Desktop\TripTeller-main\TripTeller.py", line 256, in APD(response, savefile) File "C:\Users\Owner\Desktop\TripTeller-main\TripTeller.py", line 35, in APD f.write(text + "\n") File "C:\Users\Owner\AppData\Local\Programs\Python\Python310\lib\encodings\cp1252.py", line 19, in encode return codecs.charmap_encode(input,self.errors,encoding_table)[0] UnicodeEncodeError: 'charmap' codec can't encode character '\u0107' in position 798: character maps to

conductiveIT commented 1 year ago

Could be an encoding problem. Try replacing

with open(file_name, "a+") as f:

with

with open(file_name, "a+", encoding='utf-8') as f:

(edit) Just had the same issue and this did seem to fix it.

(original) Note that I haven't tested it, this is a result of some Googling and seeing this https://stackoverflow.com/questions/27092833/unicodeencodeerror-charmap-codec-cant-encode-characters