【问题标题】:python- [Errno 20] Not a directory [closed]python- [Errno 20] 不是目录 [关闭]
【发布时间】:2021-09-19 07:45:44
【问题描述】:

我正在尝试从指定文件夹enrollemnts_rgb 读取图像 但它给出了一个错误,不在目录中

for folder_name in folder_list:
    files_list = os.listdir(os.path.join(base_dir, folder_name))
    temp=[]
    for file_name in files_list[:no_of_files_in_each_class]:
        temp.append(len(x))

【问题讨论】:

    标签: python kaggle


    【解决方案1】:

    正如您的问题所断言的那样,错误似乎是 Not a directory 而不是 not in the directory

    我的假设是您的错误实际上不在您共享的代码中。您的 folder_list 可能包含非文件夹文件。这会使 listdir 抛出错误,因为您传递的是非文件夹路径。

    检查您的 folder_list 实施。

    【讨论】:

    • 这有助于解决您的问题吗?
    猜你喜欢
    • 2016-11-18
    • 1970-01-01
    • 2021-04-09
    • 1970-01-01
    • 2014-08-21
    • 2013-08-02
    • 1970-01-01
    • 1970-01-01
    • 2015-08-04
    相关资源
    最近更新 更多