You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
app_key = '201909128757' account_name = '中国股份有限公司' in home.py
`
from dotenv import load_dotenv, find_dotenv
import os
load_dotenv(find_dotenv())
print(os.getenv('account_name'))
`
error:
File "C:\Python37\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x90 in position 447: character maps to
I can't reproduce the issue. In what encoding is your .env file and what's the default encoding on your system? You might want to try the encoding parameter of load_dotenv.
I have the same problem with the errorlog: UnicodeDecodeError: 'gbk' codec can't decode byte 0x91 in position 12: incomplete multibyte sequence
And I succeed in solve this by the following code:
load_dotenv(encoding='utf8')
手动传个编码就解决了嘛~
Reacted by Pakro, Inada Naoki, bertrandlo, Tanish Jain, Timothé, Icaro Bombonato, Bernardo Nacif and Anatoly Frolov
Activity
bbc2 commentedon Nov 15, 2020
I can't reproduce the issue. In what encoding is your .env file and what's the default encoding on your system? You might want to try the
encodingparameter ofload_dotenv.SerinaNya commentedon Jan 13, 2021
I have the same problem with the errorlog:
UnicodeDecodeError: 'gbk' codec can't decode byte 0x91 in position 12: incomplete multibyte sequenceAnd I succeed in solve this by the following code:
手动传个编码就解决了嘛~
methane commentedon Feb 13, 2021
How about changing default encoding from locale specific to UTF-8?
andodet commentedon Mar 10, 2021
Probably duplicate of #300
bbc2 commentedon Mar 10, 2021
Yes, and I think that this particular issue was resolved so let me close it.