-
Notifications
You must be signed in to change notification settings - Fork 240
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
Update simple.py,fix win10 UnicodeDecodeError #651
Conversation
fix win10 UnicodeDecodeError nr = InitNornir(config_file="config.yaml") File "d:\python38\lib\site-packages\nornir\init_nornir.py", line 64, in InitNornir inventory=load_inventory(config), File "d:\python38\lib\site-packages\nornir\init_nornir.py", line 18, in load_inventory inv = inventory_plugin(**config.inventory.options).load() File "d:\python38\lib\site-packages\nornir\plugins\inventory\simple.py", line 103, in load hosts_dict = yml.load(f) File "d:\python38\lib\site-packages\ruamel\yaml\main.py", line 343, in load return constructor.get_single_data() File "d:\python38\lib\site-packages\ruamel\yaml\constructor.py", line 111, in get_single_data node = self.composer.get_single_node() File "_ruamel_yaml.pyx", line 701, in _ruamel_yaml.CParser.get_single_node File "_ruamel_yaml.pyx", line 902, in _ruamel_yaml.CParser._parse_next_event File "_ruamel_yaml.pyx", line 911, in _ruamel_yaml.input_handler UnicodeDecodeError: 'gbk' codec can't decode byte 0xac in position 11744: illegal multibyte sequence
Hmmm, on the face of it this looks wrong to me. These are text files why would we open them as binary? I would have thought the fix would have been to specify the file encoding as utf-8? |
Agreed, this doesn't seem entirely right. This is most likely an issue with the way you saved your files so it'd be great if you could share a sample triggering the issue so we can see what's happening and why. |
cannot upload zip and yaml file,something wrong.how upload?
|
python3 Built-in Functions
|
Or force encoding ='utf8' when open file |
Ok, I just read online that in windows you need to specify the encoding or this happens. I opened #654 to:
|
exactly, I will add that to #654. Sorry for taking over your PR but wanted to make sure we could reproduce the error first in the CI to make sure we don't reintroduce it in the future by mistake |
thank you very much. |
Closing in favor of #654 |
fix win10 UnicodeDecodeError