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

Executable ... not found when running pre-commit #25

Open
CelestialGuru opened this issue Jul 2, 2021 · 9 comments
Open

Executable ... not found when running pre-commit #25

CelestialGuru opened this issue Jul 2, 2021 · 9 comments

Comments

@CelestialGuru
Copy link

Issue

When I run pre-commit run --all-files I get the following:

Trim Trailing Whitespace.................................................Passed
Fix End of Files.........................................................Passed
Check Yaml...............................................................Passed
Check for added large files..............................................Passed
yamllint.................................................................Passed
Format YAML files........................................................Failed
- hook id: yamlfmt
- exit code: 1

Executable `C:UsersUser.cachepre-commitrepoolie1bxepy_env-python3.9Scriptspython.EXE` not found

It looks like somwhere somehow the / characters are being stripped because I was able to find this:

C:\Users\User\.cache\pre-commit\repoolie1bxe\py_env-python3.9\Scripts\python.exe

I even tried renaming .../python.exe to .../python.EXE but that didn't seem to matter.

Config

My .pre-commit-config.yaml file:

# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
  - repo: 'https://github.com/pre-commit/pre-commit-hooks'
    rev: v3.2.0
    hooks:
      - id: trailing-whitespace
      - id: end-of-file-fixer
      - id: check-yaml
      - id: check-added-large-files

  - repo: https://github.com/adrienverge/yamllint.git
    rev: v1.21.0
    hooks:
      - id: yamllint
        args: [--format, parsable, --strict, --config-file, config.yamllint]

  - repo: 'https://github.com/jumanjihouse/pre-commit-hook-yamlfmt'
    rev: 0.1.0
    hooks:
      - id: yamlfmt

Environment

I am using Windows 10 Pro
I have activated a virtual environment, but both the virtual environment and the global one have pre-commit installed.
My python version is 3.9.5

@andfranklin
Copy link

I'm experiencing the same issue. My system info:

OS: Microsoft Windows Server 2016 Standard
Python: 3.7.2

@linuxdaemon
Copy link
Contributor

The issue seems to be with how the yamlfmt script is deployed. It may be best to move the main logic to a module and export an entry point for pre-commit. That seems to be how the main pre-commit-hooks repo does it.

@pritom007
Copy link

Issue

When I run pre-commit run --all-files I get the following:

Trim Trailing Whitespace.................................................Passed
Fix End of Files.........................................................Passed
Check Yaml...............................................................Passed
Check for added large files..............................................Passed
yamllint.................................................................Passed
Format YAML files........................................................Failed
- hook id: yamlfmt
- exit code: 1

Executable `C:UsersUser.cachepre-commitrepoolie1bxepy_env-python3.9Scriptspython.EXE` not found

It looks like somwhere somehow the / characters are being stripped because I was able to find this:

C:\Users\User\.cache\pre-commit\repoolie1bxe\py_env-python3.9\Scripts\python.exe

I even tried renaming .../python.exe to .../python.EXE but that didn't seem to matter.

Config

My .pre-commit-config.yaml file:

# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
  - repo: 'https://github.com/pre-commit/pre-commit-hooks'
    rev: v3.2.0
    hooks:
      - id: trailing-whitespace
      - id: end-of-file-fixer
      - id: check-yaml
      - id: check-added-large-files

  - repo: https://github.com/adrienverge/yamllint.git
    rev: v1.21.0
    hooks:
      - id: yamllint
        args: [--format, parsable, --strict, --config-file, config.yamllint]

  - repo: 'https://github.com/jumanjihouse/pre-commit-hook-yamlfmt'
    rev: 0.1.0
    hooks:
      - id: yamlfmt

Environment

I am using Windows 10 Pro
I have activated a virtual environment, but both the virtual environment and the global one have pre-commit installed.
My python version is 3.9.5

I am facing the same issue. And I have same config as yours

@vyach-vasiliev
Copy link

It might be useful for someone to know.
I found a fix in this PR and connected it correctly in this way:
.pre-commit-config.yaml

   - repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
     rev: 71af8556bfcf12745fdfdb3ed57b6698b444f58c
     hooks:
       - id: yamlfmt
         args: [--mapping, '2', --sequence, '4', --offset, '2']

@Avasam
Copy link

Avasam commented Mar 25, 2023

Classic backslashes in path on Windows not being escaped :)
Got this too.

@larskinder
Copy link

Hey, I encountered the same issue and wanted to ask, if there is a fix for the removal of the backslashes?

@cedric-aebi
Copy link

Still no fix?

@tahq69
Copy link

tahq69 commented Oct 27, 2023

Same error in Windows 10

@danielwiegand
Copy link

I ended up using pre-commit in WSL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants