I have seen answers about how to create symbolic links on Windows using Python (I am on Win 7). However the links does not show up in the system for some reason even though the call claim success. Am I missing something obvious ?
>>> import ctypes
>>> kdll = ctypes.windll.LoadLibrary("kernel32.dll")
>>> kdll.CreateSymbolicLinkA("C:\\testlink", "C:\\existing_dir", 1)
1
>>> ctypes.WinError()
WindowsError(0, 'The operation completed successfully.')
>>> kdll.CreateSymbolicLinkA("C:\\testlink", "C:\\existing_dir", 1)
0
>>> ctypes.WinError()
WindowsError(0, 'Cannot create a file when that file already exists.')
>>> os.path.exists("C:\\testlink")
False
>>> os.path.islink("C:\\testlink")
False
Why does the calls to the windows api think that that the link was created when python can't see it with os.path.exist ? And neither can I see the link in the file explorer or using dir
in cmd on the Windows box. So where did the link go ?