0

Are Windows 10 symbolic links supported by Python 3?

I've created a symbolic link using mklink on Windows but when I call Python's open on it, I get a message that the file does not exist.

Note that this is not a shortcut Windows file (which is of course just a regular file with redirecting information that Windows Explorer uses), but a symbolic link.

I expected this symbolic link to be treated transparently by the file system, that is, that the file system would give access to the target file to any application (including Python) accessing the link. Isn't it how it is supposed to work?

user118967
  • 4,895
  • 5
  • 33
  • 54
  • This question is from before Windows 10, but worth checking out: [Symlinks on windows?](https://stackoverflow.com/q/1447575/4518341) – wjandrea Aug 05 '19 at 23:09
  • 1
    Note that this question looks similar, but it turned out to be user error: [Opening a file which is a symlink in Python](https://stackoverflow.com/q/50321207/4518341) – wjandrea Aug 05 '19 at 23:12
  • 1
    @wjandrea: Though it might turn out to be the same error; we need a [MCVE] from the OP. – ShadowRanger Aug 05 '19 at 23:17
  • 1
    @ShadowRanger Agreed, an MRE would help greatly. Also just to be clear I'm not necessarily suggesting a duplicate, just some resources OP could check out. – wjandrea Aug 05 '19 at 23:19
  • 1
    It is indeed a duplicate of "Opening a file...". Same user error! Namely, bad usage of mklink with a relative path. In those cases, the link is relative to the symbolic link's path, not to the path where the mklink command is executed as I had assumed. Thank you! – user118967 Aug 06 '19 at 02:28

0 Answers0