aiohttp-swagger icon indicating copy to clipboard operation
aiohttp-swagger copied to clipboard

UnicodeDecodeError

Open TheDeadOne opened this issue 6 years ago • 0 comments

On Windows when using swagger_from_file argument and YAML file contains Cyrillic letters I get an error:

Traceback (most recent call last):
  File "app.py", line 162, in <module>
    setup_swagger(app, swagger_from_file='swagger.yaml')
  File "D:\playground\python\env3\lib\site-packages\aiohttp_swagger\__init__.py"
, line 58, in setup_swagger
    swagger_info = load_doc_from_yaml_file(swagger_from_file)
  File "D:\playground\python\env3\lib\site-packages\aiohttp_swagger\helpers\buil
ders.py", line 123, in load_doc_from_yaml_file
    loaded_yaml = yaml.load(open(doc_path, "r").read())
  File "D:\playground\python\env3\lib\encodings\cp1251.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x98 in position 871: char
acter maps to <undefined>

TheDeadOne avatar Mar 14 '18 13:03 TheDeadOne