-
-
Notifications
You must be signed in to change notification settings - Fork 449
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
Flycheck checker python-flake8 returned non-zero exit code 1, but its output contained no errors #1228
Comments
I got the same problem. I can run flake8 from the shell without any problem but it throws error when used with flycheck. In fact, elpy utilize flake8 too but doesn't observe the problem. |
I had the same problem, flake8 gives the error because it doesn't get utf-8 as input. Doing C-h C RET my settings were:
Adding
Which results in emacs giving the buffer to flake8 as utf-8. |
@dekkers Good find! @LeeiFrankJaw @galeo, does changing the encoding in Emacs fixes this for you? I'm not sure we should fix this directly in Flycheck. But, we could indicate in the documentation to set your coding system to utf-8. And/or to check it in a What do you think @cpitclaudel ? |
I'm not sure. I think we should be consistent about the encoding we use to send files over to checkers, especially through stdin. |
What about using the encoding for the buffer? That would probably be the less surprising behavior. |
Possibly? Or we could standardize and always send utf-8 |
That was my first thought as well, but then I know utf-8 is not universally used, at least for text. The question is: would it ever make sense to not send utf-8 to a checker? If it does, we would then have to introduce a variable to toggle this behavior, or worse, to set the encoding used by Flycheck, which seems redundant with the Emacs settings. |
The settings of mine:
The coding system is always set to utf-8. |
Right — if the checker accepts input from disk too, it should be fine to send it data in the file's original encoding. I wonder what (currently) happens if a user inserts an unsupported character in a buffer and flycheck runs right after that. |
@galeo Curious. If your buffer is in utf-8, and your coding system prefs are utf-8 everywhere, then I don't know what's happening here. I've tried to reproduce with your example, but flake8 does not complain about the unicode character here. (Granted, I'm using 24.5 on Linux). Maybe a package is overriding your coding system somehow? Have you tried with to reproduce from
|
@fmdkdd I've made an investigation and could confirm that it works OK when start emacs from a shell. However, when start emacs from GUI, the problem occurs. The environment variables inherited by emacs from a shell and GUI are different, I could not figure out what causes this problem. I am using macOS Sierra 10.12.4 and emacs 25.2 installed with Homebrew ( |
@galeo Ah! Thanks for looking into it :) If it's an environment issue, try to follow these instructions. |
I meet this problem for a long time, and found the way to fix it today. I use fish as my default shell. And
The important setting here is Then, open emacs and run shell command use I fix this by create a file
Hope this will help someone meet this problem too. |
It works. Thanks so much! |
this one works for me. |
Thanks for this. However, setting a |
When checking a python3 file whose code contains unicode characters, the python-flake8 checker gets errors. Here is the
flycheck-compile
output:However, if execute the command
flake8 --format\=default --stdin-display-name /Users/galeo/Desktop/flycheck-error.py - < /Users/galeo/Desktop/flycheck-error.py
used by flycheck in the shell, it works OK!Using
pip3 install flake8
makes flake8 check the syntax for Python 3, here is the test code that could reproduce the error:This is the
flycheck-verify-setup
output:The text was updated successfully, but these errors were encountered: