question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pre-commit install fails on Windows network mount drive

See original GitHub issue

Hi, I’m trying to help some team members set up pre-commit on a Windows network mount drive, and they’re encountering an issue with paths. Seems related to this comment in #1610, which seems to be a different issue than the one the original issue, as we are on the most recent version of pre-commit and git, and the fix that was merged in #1727 for that doesn’t seem to address this issue. I also tried other versions of Git for Windows <2.25, and the issue still seemed to persist.

I tested the solution that @christopherdoyle proposed, and that does seems to fix this issue with network mount drives, though I saw that @asottile would prefer not to use pathlib. I am not able to propose a fix right now, but I wanted to raise this as an issue that still exists.

Full error below:

    ### version information
    
    ```
    pre-commit version: 2.10.1
    sys.version:
        3.9.1 | packaged by conda-forge | (default, Jan 26 2021, 01:29:07) [MSC v.1916 64 bit (AMD64)]
    sys.executable: C:\Users\roderick\.conda\envs\nmt\python.exe
    os.name: nt
    sys.platform: win32
    ```
    
    ### error information
    
    ```
    An unexpected error has occurred: ValueError: path is on mount 'S:', start on mount '\\\\MyServer\Directory'
    ```
    
    ```
    Traceback (most recent call last):
      File "C:\Users\roderick\.conda\envs\nmt\lib\site-packages\pre_commit\error_handler.py", line 65, in error_handler
        yield
      File "C:\Users\roderick\.conda\envs\nmt\lib\site-packages\pre_commit\main.py", line 333, in main
        _adjust_args_and_chdir(args)
      File "C:\Users\roderick\.conda\envs\nmt\lib\site-packages\pre_commit\main.py", line 153, in _adjust_args_and_chdir
        args.config = os.path.relpath(args.config)
      File "C:\Users\roderick\.conda\envs\nmt\lib\ntpath.py", line 703, in relpath
        raise ValueError("path is on mount %r, start on mount %r" % (
    ValueError: path is on mount 'S:', start on mount '\\\\MyServer\Directory'

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
faphcommented, Feb 23, 2021

From the docs (https://docs.python.org/3/library/os.path.html#os.path.realpath):

os.path.realpath(path) Return the canonical path of the specified filename, eliminating any symbolic links encountered in the path (if they are supported by the operating system).

Note When symbolic link cycles occur, the returned path will be one member of the cycle, but no guarantee is made about which member that will be. Changed in version 3.6: Accepts a path-like object.

Changed in version 3.8: Symbolic links and junctions are now resolved on Windows.

0reactions
goroderickgocommented, Feb 26, 2021

Yep, also works for me. Thanks for the quick fix!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Push git changes to a shared network drive - Stack Overflow
Then create an empty git repository. If you do not use the --bare option, you will have issues so don't leave that out....
Read more >
Network adapters are not started after Windows Server 2012 ...
Fixes an issue in which network adapters don't start after you run Windows Server 2012 Setup.
Read more >
Docker executor - GitLab Docs
The Docker executor supports the following configurations. For known issues and additional requirements of Windows configurations, see Use Windows containers.
Read more >
Remote Development Tips and Tricks - Visual Studio Code
Visual Studio Code Remote Development troubleshooting tips and tricks for SSH, ... for Windows, you can use the File Explorer's Map Network Drive......
Read more >
QEMU - ArchWiki
5.8.1.1 set up the windows disk interface drivers ... 15 Troubleshooting ... The installation medium should not be mounted because QEMU ...
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