-
Notifications
You must be signed in to change notification settings - Fork 51
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
"'ascii' codec can't decode byte 0xc3 in position 1: ordinal not in range(128)" #24
Comments
@EloiZ Sorry for my late reply. In my environment I couldn't reproduce the error. |
I ran into this issue after upgrading from 1.0.7 to 1.1.1. Investigating … EDIT: file said 1.0.6, but turns out it corresponds to git tag 1.0.7 |
@pseyfert Please tell me the code that I can reproduce and your environment? |
So my understanding is, this is due to the following change from 1.0.7 to 1.1.0: In 1.0.7 the buffer gets written to a temporary file on which autopep8 is run. In 1.0.1 autopep8 is used in the commandline mode, here (my version of) So apparently autopep8 handles input encoding differently in command line mode Reverting this in vim-autopep8 (at least the quick revert I did) will break the This is with autopep8 version 0.9.1 (python2). I tested with this |
I could check the error. If you update autopep8 to v1.3.4, no error will occur. |
Thanks for the quick feedback. Anyway, I tried with autopep8 v1.3.4 and the error somewhat persists. I could actually reproduce it outside of vim with:
(and the same with Do you have some global config that sets the python/autopep8 encoding to utf-8? (I'm wondering why it works for you but not for me.) Looking at hhatto/autopep8#148 I was successful with
Given the out-of-vim reproducer, this is probably an autopep issue8, but I'm wondering if vim-autopep8 can/could/should call autopep8 like that with encoding. |
Set the environment variable PYTHONIOENCODING for autopep8 to the value of the vim option 'encoding'. See tell-k#24.
c28fc9a fixes the behavior for me in a debian:experimental docker container (python2, autopep8 1.3.4). With autopep8 0.9.1 on stable, the issue persists (PYTHONIOENCODING apparently ignored), but I'm out of ideas for the old autope8 version for now. |
No, I don't have any config for autopep8.
|
I'm using this Dockerfile at the moment:
and get as output:
i.e. |
Hi,
when i run vim-autopep8 plugin on a python script that contains an non-ascii character, my whole file get replaced by a traceback error. When i directly run
autopep8 -i myfile.py
, it works flawlessly. Any idea where the bug comes from? Thanks a lotPython script: (note the non-ascii character
é
that creates the bug)The file gets replaced by:
The text was updated successfully, but these errors were encountered: