Skip to content

config.from_pyfile crashes on Python 3 when source isn't encoded in default encoding #2118

@xinyvz

Description

@xinyvz

when I read my instance config file, I get an error.

exec(compile(config_file.read(), filename, 'exec'), d.dict)
UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 437: illegal multibyte sequence
Then I modify the code of config.from_pyfile to this

with open(filename, 'rb') as config_file:
The problem is resolved.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions