X Tutup
The Wayback Machine - https://web.archive.org/web/20210118214941/https://github.com/theskumar/python-dotenv/issues/207
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

load_dotenv() UnicodeDecodeError #207

Open
wucong60 opened this issue Oct 1, 2019 · 2 comments
Open

load_dotenv() UnicodeDecodeError #207

wucong60 opened this issue Oct 1, 2019 · 2 comments

Comments

@wucong60
Copy link

@wucong60 wucong60 commented Oct 1, 2019

in .evn file

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

@bbc2
Copy link
Collaborator

@bbc2 bbc2 commented 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 encoding parameter of load_dotenv.

@jinzhijie
Copy link

@jinzhijie jinzhijie commented Jan 13, 2021

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')

手动传个编码就解决了嘛~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.
X Tutup