有没有人知道从Python的win32版本中创建/读取符号链接的方法?理想情况下,应该有最少量的平台特定代码,因为我需要我的应用程序是跨平台的.
我试图symlinks在Windows 8上使用Python 创建.我发现了这篇帖子,这是我脚本的一部分.
import os
link_dst = unicode(os.path.join(style_path, album_path))
link_src = unicode(album_path)
kdll = ctypes.windll.LoadLibrary("kernel32.dll")
kdll.CreateSymbolicLinkW(link_dst, link_src, 1)
Run Code Online (Sandbox Code Playgroud)
首先,它只有在通过管理员cmd执行时才能创建符号链接.为什么会这样?
其次,当我试图从Windows资源管理器中打开这些符号链接时,我得到此错误:
...Directory is not accessible. The Name Of The File Cannot Be Resolved By The System.
Run Code Online (Sandbox Code Playgroud)
有没有更好的方法使用Python创建符号链接?如果没有,我该如何解决?
编辑
这是foralbum_linker中的循环:
def album_Linker(album_path, album_Genre, album_Style):
genre_basedir = "E:\Music\#02.Genre"
artist_basedir = "E:\Music\#03.Artist"
release_data_basedir = "E:\Music\#04.ReleaseDate"
for genre in os.listdir(genre_basedir):
genre_path = os.path.join(genre_basedir, "_" + album_Genre)
if not os.path.isdir(genre_path):
os.mkdir(genre_path)
album_Style_list = album_Style.split(', ')
print album_Style_list
for style in …Run Code Online (Sandbox Code Playgroud)