pipenv run pre-commit --all failed with: An unexpected error has occurred: AttributeError: type object 'Hook' has no attribute 'create
pipenv run pre-commit --all failed with: An unexpected error has occurred: AttributeError: type object 'Hook' has no attribute 'create
在我的预提交-config.yaml 文件中,我正在尝试 运行 黑色,python 代码格式化程序
repos:
- repo: https://github.com/python/black
rev: stable
hooks:
- id: black
language_version: python3.6
但是每当我用 pipenv run pre-commit --all
尝试 运行ning black 时,代码将失败并显示错误消息
An unexpected error has occurred: AttributeError: type object 'Hook' has no attribute 'create'
Check the log at some_path
当我去 some_path
时,我在那里找不到任何日志。我尝试不 运行 宁 pipenv run pre-commit --all
将黑色应用于我的代码,但是当我尝试 git commit
任何新文件时错误仍然出现。有什么办法可以解决吗?
我在使用 python 3.6.0 时遇到过这个问题,我已经升级到 python 3.6.9 并且不再出现此错误。
我没有尝试升级我的 python,但我尝试了以下步骤并且对我有效
1. pipenv shell
2. pip install black
3. black name_of_the_directory_you_want_to_format
这是 python 3.6.0(这个确切的补丁版本)的错误,并且在版本 2.0.0 和 2.1.0
之间预先提交
这已在 2.1.1 中修复:https://github.com/pre-commit/pre-commit/blob/master/CHANGELOG.md#211---2020-02-24
免责声明:我是预提交的作者
在我的预提交-config.yaml 文件中,我正在尝试 运行 黑色,python 代码格式化程序
repos:
- repo: https://github.com/python/black
rev: stable
hooks:
- id: black
language_version: python3.6
但是每当我用 pipenv run pre-commit --all
尝试 运行ning black 时,代码将失败并显示错误消息
An unexpected error has occurred: AttributeError: type object 'Hook' has no attribute 'create'
Check the log at some_path
当我去 some_path
时,我在那里找不到任何日志。我尝试不 运行 宁 pipenv run pre-commit --all
将黑色应用于我的代码,但是当我尝试 git commit
任何新文件时错误仍然出现。有什么办法可以解决吗?
我在使用 python 3.6.0 时遇到过这个问题,我已经升级到 python 3.6.9 并且不再出现此错误。
我没有尝试升级我的 python,但我尝试了以下步骤并且对我有效
1. pipenv shell
2. pip install black
3. black name_of_the_directory_you_want_to_format
这是 python 3.6.0(这个确切的补丁版本)的错误,并且在版本 2.0.0 和 2.1.0
之间预先提交这已在 2.1.1 中修复:https://github.com/pre-commit/pre-commit/blob/master/CHANGELOG.md#211---2020-02-24
免责声明:我是预提交的作者