小编Qui*_*ips的帖子

Python - 尝试复制文件时 Errno 13 权限被拒绝

我正在尝试用 Python 制作一个程序,将我的闪存驱动器上的文件(字母 D:)复制到我硬盘驱动器上的一个文件夹中,但我收到了PermissionError: [Errno 13] Permission denied: 'D:'

我的代码有问题的部分如下:

# Copy files to folder in current directory
def copy():
    source = getsource()

    if source != "failure":

        copyfile(source, createfolder())
        wait("Successfully backup up drive"
             "\nPress 'Enter' to exit the program")

    else:
        wait("No USB drive was detected"
             "\nPress 'Enter' to exit")

# Create a folder in current directory w/ date and time
def createfolder():
    name = strftime("%a, %b %d, %Y, %H.%M.%S", gmtime())
    dir_path = os.path.dirname(os.path.realpath(__file__))
    new_folder = dir_path + "\\" …
Run Code Online (Sandbox Code Playgroud)

python file-copying

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

标签 统计

file-copying ×1

python ×1