Skip to content
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

No output when stdin used on Windows #1195

Closed
PeterJCLaw opened this issue May 8, 2020 · 1 comment
Closed

No output when stdin used on Windows #1195

PeterJCLaw opened this issue May 8, 2020 · 1 comment
Labels
bug Something isn't working

Comments

@PeterJCLaw
Copy link

If running type file.py | isort - --diff on Windows there is often no output given, even if there is sorting to do. This affects at least the VSCode integration and possibly other IDE integrations.

I actually think this is a Python bug (reported as https://bugs.python.org/issue40540), however there may be something which isort can do to work around it.

Currently isort looks for a coding comment in the input source and thus seeks within the input file having done that. Unfortunately that seems to cause issues on Windows, where further reads from stdin return no data.

For microsoft/vscode-python#9128 we're working around this by replacing stdin with an io.BytesIO so that isort can reliably seek within that stream. Obviously this isn't great and while it's not isort's fault (and this likely affects other tools too), one option would be for isort itself to use this io.BytesIO trick (or an equivalent fix) so that individual integrations don't need to patch around it.

I realise that the main focus of development now appears to be on 5.x, however would you be open to a patch against the 4.x stream which fixed this issue there?

@timothycrosley timothycrosley added the bug Something isn't working label Jul 16, 2020
@timothycrosley
Copy link
Member

Thanks for reporting! This is verified to be fixed on the latest release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants