Используйте черный с python 3.7 в качестве крючка для предварительной фиксации - PullRequest
0 голосов
/ 22 января 2020

Я пытаюсь использовать черный при предварительной фиксации, используя следующие настройки:

repos:
-   repo: https://github.com/ambv/black
    rev: stable
    hooks:
    - id: black
      language_version: python3.7

К сожалению, я получаю эту ошибку: (этого не произойдет, если я попытаюсь отформатировать с python3 .6, но мне очень нужны 3,7!)

### version information

```
pre-commit version: 1.21.0
sys.version:
    2.7.15 (default, Jan 12 2019, 21:07:57) 
    [GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.11.45.5)]
sys.executable: /usr/local/opt/python@2/bin/python2.7
os.name: posix
sys.platform: darwin
```

### error information

```
An unexpected error has occurred: CalledProcessError: command: ('/usr/local/opt/python@2/bin/python2.7', '-mvirtualenv', '/Users/user name/.cache/pre-commit/repoi4s0y8j6/py_env-python3.7', '-p', 'python3.7')
return code: 3
expected return code: 0
stdout:
    The path python3.7 (from --python=python3.7) does not exist

stderr: (none)
```

```
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/pre_commit/error_handler.py", line 72, in error_handler
    yield
  File "/usr/local/lib/python2.7/site-packages/pre_commit/main.py", line 344, in main
    return run(args.config, store, args)
  File "/usr/local/lib/python2.7/site-packages/pre_commit/commands/run.py", line 292, in run
    install_hook_envs(hooks, store)
  File "/usr/local/lib/python2.7/site-packages/pre_commit/repository.py", line 220, in install_hook_envs
    hook.install()
  File "/usr/local/lib/python2.7/site-packages/pre_commit/repository.py", line 98, in install
    self.prefix, self.language_version, self.additional_dependencies,
  File "/usr/local/lib/python2.7/site-packages/pre_commit/languages/python.py", line 169, in install_environment
    _make_venv(env_dir, python)
  File "/usr/local/lib/python2.7/site-packages/pre_commit/languages/python.py", line 181, in make_venv
    cmd_output_b(*cmd, env=env, cwd='/')
  File "/usr/local/lib/python2.7/site-packages/pre_commit/util.py", line 141, in cmd_output_b
    raise CalledProcessError(returncode, cmd, retcode, stdout_b, stderr_b)
CalledProcessError: command: ('/usr/local/opt/python@2/bin/python2.7', '-mvirtualenv', '/Users/user name/.cache/pre-commit/repoi4s0y8j6/py_env-python3.7', '-p', 'python3.7')
return code: 3
expected return code: 0
stdout:
    The path python3.7 (from --python=python3.7) does not exist

stderr: (none)

```

Есть идеи как ее решить?

...