profile
viewpoint

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

<!-- Please search existing issues to avoid creating duplicates. -->

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

microsoft/vscode-python

Answer questions karrtikr

@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.

useful!
source:https://uonfu.com/
Github User Rank List