相关疑难解决方法(0)

Windows中的OS.symlink支持

我从python网站下载了python 2.7.1并将其安装到windows.在尝试符号链接文件时,我发现它不受支持.

但是,我发现了这个问题,并发现它已修复.这会被实施,如果是这样的话?我正在运行Windows Vista.

windows-vista python-2.7

19
推荐指数
3
解决办法
2万
查看次数

在Python中创建NTFS交接点

有没有办法在Python中创建NTFS交接点?我知道我可以调用该junction实用程序,但最好不要依赖外部工具.

python windows ntfs junction

15
推荐指数
3
解决办法
8285
查看次数

在Windows上使用mercurial跟踪硬链接或符号链接

在一个相当大的项目中,我想将相同的文件(或文件夹)放在不同的位置.在一个位置更改时,应传播更改.在Subversion中,我可以使用externals来实现这种行为.

我试图通过使用硬链接和符号链接来解决这个问题,但Mercurial似乎没有跟踪它们中的任何一个.相反,它将文件的内容提交到其存储库而不是link属性.当我克隆存储库时,信息会丢失.

这是Mercurial特定于Windows的行为还是根本无法跟踪链接?是否有其他方法可以跟踪可从Mercurial中的不同位置访问的文件?

windows mercurial

14
推荐指数
1
解决办法
4000
查看次数

使用struct作为python ctypes模块的函数参数

所以我试图将用于处理Windows上的连接/符号链接/等的python C扩展程序移植到使用ctypes模块的纯Python.不幸的是,由于我之前使用的ctypes非常有限,我想我可能会在某处导致我的代码无法正常运行时出错.这是我到目前为止所拥有的:

from os import path
from ctypes import *
from ctypes.wintypes import *

# Python implementation of:
#
# typedef struct {
#       DWORD   ReparseTag;
#       DWORD   ReparseDataLength;
#       WORD    Reserved;
#       WORD    ReparseTargetLength;
#       WORD    ReparseTargetMaximumLength;
#       WORD    Reserved1;
#       WCHAR   ReparseTarget[1];
# } REPARSE_MOUNTPOINT_DATA_BUFFER, *PREPARSE_MOUNTPOINT_DATA_BUFFER;

class ReparsePoint(Structure):
    _fields_ = [
        ("ReparseTag", DWORD),
        ("ReparseDataLength", DWORD),
        ("Reserved", WORD),

        ("ReparseTargetLength", WORD),
        ("ReparseTargetMaximumLength", WORD),
        ("Reserved1", WORD),
        ("ReparseTarget", c_wchar_p),
    ]

GENERIC_READ = 0x80000000
GENERIC_WRITE = 0x40000000

FILE_SHARE_DELETE = 0x00000004
FILE_SHARE_READ = 0x00000001 …
Run Code Online (Sandbox Code Playgroud)

python winapi ctypes

5
推荐指数
1
解决办法
1600
查看次数

如何使用Python在Windows中创建符号链接?

我试图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)

python directory symlink ctypes operating-system

2
推荐指数
2
解决办法
4248
查看次数