pre-commit-hook-yamlfmt icon indicating copy to clipboard operation
pre-commit-hook-yamlfmt copied to clipboard

File path issue when running locally on Windows

Open MartinSovikEquinor opened this issue 2 years ago • 9 comments

Hi. The senior developer on my team has set up pre-commit hooks using this utility. The pre-commit succeeds in github, but when I run it locally, I get an error like this:

$ git commit -m "Line ending fix"
Trim Trailing Whitespace.................................................Passed
Fix End of Files.........................................................Passed
Check Yaml...............................................................Passed
Check JSON...........................................(no files to check)Skipped
Check Toml...........................................(no files to check)Skipped
Check for added large files..............................................Passed
Check for case conflicts.................................................Passed
Check for broken symlinks............................(no files to check)Skipped

Executable `C:UsersMSOV.cachepre-commitrepo3vt2tuwjpy_env-python3.10Scriptspython.EXE` not found

The exe files exist:

 Directory of C:\Users\MSOV\.cache\pre-commit\repo3vt2tuwj\py_env-python3.10\Scripts

06.04.2022  13:54    <DIR>          .
06.04.2022  13:54    <DIR>          ..
06.04.2022  13:53             2 185 activate
06.04.2022  13:53             1 025 activate.bat
06.04.2022  13:53             3 062 activate.fish
06.04.2022  13:53             1 369 activate.nu
06.04.2022  13:53             1 758 activate.ps1
06.04.2022  13:53             1 193 activate_this.py
06.04.2022  13:53               510 deactivate.bat
06.04.2022  13:53               333 deactivate.nu
06.04.2022  13:53           106 904 pip-3.10.exe
06.04.2022  13:53           106 904 pip.exe
06.04.2022  13:53           106 904 pip3.10.exe
06.04.2022  13:53           106 904 pip3.exe
06.04.2022  13:53                24 pydoc.bat
06.04.2022  13:53           263 056 python.exe
06.04.2022  13:53           251 792 pythonw.exe
06.04.2022  13:53           106 891 wheel-3.10.exe
06.04.2022  13:53           106 891 wheel.exe
06.04.2022  13:53           106 891 wheel3.10.exe
06.04.2022  13:53           106 891 wheel3.exe
06.04.2022  13:54             4 450 yamlfmt
              20 File(s)      1 385 937 bytes
               2 Dir(s)  668 514 533 376 bytes free

but the path seems to have a problem

MartinSovikEquinor avatar Apr 06 '22 12:04 MartinSovikEquinor

Hi Martin,

I have the same problem. Did you solve it?

csabagabor80 avatar May 04 '22 15:05 csabagabor80

Hi. No, I think we just disabled this particular commit hook, sorry.

MartinSovikEquinor avatar May 05 '22 06:05 MartinSovikEquinor

Having the same issue. One possible solution might be using console_scripts instead of scripts (https://stackoverflow.com/questions/73136027/executable-scriptspython-exe-not-found-for-pre-commit-lose-slashes) I'll submit a PR.

daniela-winkler avatar Aug 15 '22 15:08 daniela-winkler

Hey @daniela-winkler, did you create a PR for this issue and manage to fix it?

larskinder avatar Apr 28 '23 08:04 larskinder

same issue here, would be great to get support for running this pre-commit hook under Windows too

spex66 avatar Jun 02 '23 09:06 spex66

+1

zachmostowsky avatar Jul 03 '23 15:07 zachmostowsky

Still no fix?

cedric-aebi avatar Aug 03 '23 11:08 cedric-aebi

The same issue with 0.2.1 and 0.2.3

kokorin avatar Aug 22 '23 08:08 kokorin

chiming in here, fails on windows for me too. Just needs / instead of \ :(

alex-ong avatar Jan 05 '24 07:01 alex-ong