question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"write EPIPE" error when running "Python Refactor: Sort Imports"

See original GitHub issue

Environment data

  • VS Code version: Version: 1.48.0-insider
  • Extension version (available under the Extensions sidebar): v2020.7.94776
  • OS and version: MacOS 10.14.6 (AMD hackintosh if that matters)
  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.8.2
  • Type of virtual environment used (N/A | venv | virtualenv | conda | …): virtualenv
  • Relevant/affected Python packages and their versions: isort 4.3.21
  • Relevant/affected Python-related VS Code extensions and their versions: N/A
  • Value of the python.languageServer setting: Jedi

Expected behaviour

Given input file main.py:

from typing import List, Optional
from datetime import datetime

print("Hello World")

Using the python extension’s “Python Refactor: Sort Imports” command, it should rearrange the imports in alphabetical order to the following:

from datetime import datetime
from typing import List, Optional

print("Hello World")

Actual behaviour

After pressing cmd+shift+P and selecting “Python Refactor: Sort Imports”, I get this little error popup saying “write EPIPE” (see image).

image

NOTE: this works properly when runningisort main.py manually from the terminal

Steps to reproduce:

./.vscode/settings.json

{
    "python.pythonPath": "venv/bin/python",
    "python.sortImports.path": "isort"
}
  1. create file main.py above
  2. create a virtual environment - virtualenv venv
  3. activate virtual environment - source venv/bin/activate
  4. install isort dependency - pip install isort
  5. Open command palette (cmd+shift+P on mac)
  6. Search “Python Refactor: Sort Imports” and select the correct command
  7. Press Enter

Logs

N/A

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:16

github_iconTop GitHub Comments

2reactions
karrtikrcommented, Aug 20, 2020

@jaklan @hkennyv This is a duplicate of https://github.com/microsoft/vscode-python/issues/7042. The error message is different from one before because we changed how we’re running isort, but it’s the same issue.

2reactions
jaklancommented, Aug 14, 2020

@hkennyv it’s not a mistake - this is an error, "python.sortImports.path": "isort" should work the same way the isort command works within virtualenv (and for other tools like e.g. black that’s working with no problem).

Read more comments on GitHub >

github_iconTop Results From Across the Web

VS Code's "Sort Imports" fails with exception - Stack Overflow
I've updated the full stack trace. Steps to reproduce: 1. Open a python script with multiple import lines 2. Open command palette 3....
Read more >
Error: write EPIPE - Scripting - McNeel Forum
The problem is that when I run a python file from within VS, I get the “Error: write EPIPE”. Here is what happens...
Read more >
While running post-startup callbacks: error: write EPIPE after ...
Easiest solution is to refactor the function into a separate file without the blaze dependency which both server and client can import.
Read more >
Changelog - Sphinx documentation
Now Sphinx installs them on running application. sphinx.ext.autodoc crashes if target code imports * from mock modules by autodoc_mock_imports .
Read more >
2011-March.txt - Python mailing list
2011) | 4 lines Recommend inspecting the errno attribute of socket.error objects, ... buffering=0) + try: + f.seek(0x80000001) + f.write(b'x') + f.flush() + ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found