[WinError 123] The syntax for filename, directory name, or volume label is incorrect: ''

See original GitHub issue

I try to install pre-commit with the manual from pre-commit.com.

At step 3 I get the following error message on a Windows 10 machine:

[WinError 123] The syntax for filename, directory name, or volume label is incorrect: ''


.pre-commit-config.yaml

# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
-   repo: https://server/Sandbox/Repo/_git/Repo
    rev: v2.4.0
    hooks:
    -   id: trailing-whitespace
    -   id: end-of-file-fixer
    -   id: check-added-large-files

error information

An unexpected error has occurred: OSError: [WinError 123] Die Syntax für den Dateinamen, Verzeichnisnamen oder die Datenträgerbezeichnung ist falsch: ''
Traceback (most recent call last):
  File "c:\user\programme\python\python37-32\lib\site-packages\pre_commit\error_handler.py", line 72, in error_handler
    yield
  File "c:\user\programme\python\python37-32\lib\site-packages\pre_commit\main.py", line 294, in main
    _adjust_args_and_chdir(args)
  File "c:\user\programme\python\python37-32\lib\site-packages\pre_commit\main.py", line 125, in _adjust_args_and_chdir
    os.chdir(git.get_root())
OSError: [WinError 123] Die Syntax für den Dateinamen, Verzeichnisnamen oder die Datenträgerbezeichnung ist falsch: ''

–version Python 3.7.3 pre-commit 1.20.0

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:13 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
asottilecommented, Nov 18, 2019

The next release (probably v1.20.1 when I have some time to release) will include a better error message for this:

$ pre-commit install
An error has occurred: FatalError: git toplevel unexpectedly empty! make sure you are not inside the `.git` directory of your repository.
Check the log at /home/asottile/.cache/pre-commit/pre-commit.log

I’m also seeing if I can fix this from the git side, since the behaviour seems quite strange!

0reactions
asottilecommented, Jan 2, 2020

This has been released as part of v1.21.0 (it was also fixed in git 1.24 I believe) – thanks again for the issue 🎉!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python WindowsError: [Error 123] The filename, directory ...
WindowsError: [Error 123] The filename, directory name, or volume label syntax is incorrect. I'm not able to find where the issue is. import...
Read more >
Python WindowsError: [Error 123] The filename, directory ...
Python WindowsError: [Error 123] The filename, directory name, or volume label syntax is incorrect · Issue Description · Resolution · What is 'r' ......
Read more >
[WinError 123] The filename, directory name, or ... - GitHub
I tried to train the using the 'runner.py' but it came out with this. File "C:\Users\Ilham\AppData\Local\Programs\Python\Python39\lib\site- ...
Read more >
[WinError 123] The filename, directory name, or volume label ...
[WinError 123] The filename, directory name, or volume label syntax is incorrect: '<frozen importlib._bootstrap>'.
Read more >
The filename, directory name or volume label is incorrect
The issue here is with your string containing the path to the file: "C:\\Users\\LK\\source\repos\dsd-ica-perf\\src\\et.ure.ica.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found