简体   繁体   English

"IsADirectoryError:[Errno 21] 是目录:'\/'"

[英]IsADirectoryError: [Errno 21] Is a directory: '/'

I am trying to use Images stored inside the directory by using this code,我正在尝试通过使用此代码来使用存储在目录中的图像,

import random

path = "/content/drive/MyDrive/Colab Notebooks/Low Images/*.png"
low_light_images = glob(path)
for image_path in random.choice(low_light_images):
    original_image, output_image = inferer.infer(image_path)
    plot_result(original_image, output_image)

But getting this error,但是遇到这个错误,

---------------------------------------------------------------------------
IsADirectoryError                         Traceback (most recent call last)
<ipython-input-62-668719a88426> in <module>()
      4 low_light_images = glob(path)
      5 for image_path in random.choice(low_light_images):
----> 6     original_image, output_image = inferer.infer(image_path)
      7     plot_result(original_image, output_image)

1 frames
/usr/local/lib/python3.7/dist-packages/PIL/Image.py in open(fp, mode)
   2841 
   2842     if filename:
-> 2843         fp = builtins.open(filename, "rb")
   2844         exclusive_fp = True
   2845 

IsADirectoryError: [Errno 21] Is a directory: '/'

How can I resolve this?我该如何解决这个问题? Full Code Link: here完整代码链接: 这里

The line线

for image_path in random.choice(low_light_images):

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 IsADirectoryError:[Errno 21]是目录(在AudioSegment中) - IsADirectoryError: [Errno 21] Is a directory ( in AudioSegment) &quot;IsADirectoryError: [Errno 21] Is a directory: &quot; It is a file - "IsADirectoryError: [Errno 21] Is a directory: " It is a file “IsADirectoryError:[Errno 21]是一个目录”,当它是一个文件时 - “IsADirectoryError: [Errno 21] Is a directory” when it is a file Pytorch:IsADirectoryError:[Errno 21] - Pytorch: IsADirectoryError: [Errno 21] IsADirectoryError:[Errno 21] 是目录:使用多处理时出现“/”错误 - IsADirectoryError: [Errno 21] Is a directory: '/' error while using multiprocessing 为什么我会收到这个 IsADirectoryError: [Errno 21]? - why am i getting this IsADirectoryError: [Errno 21]? IsADirectoryError: [Errno 21] 是目录:'/' 将文件从一个文件夹复制到另一个现有文件夹时 Python - IsADirectoryError: [Errno 21] Is a directory: '/' while copying files from one folder to another existing folder Python IsADirectoryError:[Errno 21] 尝试将图像复制到另一个文件时出现目录错误 - IsADirectoryError: [Errno 21] Is a directory ERROR when trying to copy images into another file OSError: [Errno 21] 是一个目录 - OSError: [Errno 21] Is a directory 我收到此错误:[Errno 21] 是一个目录: - I get this error : [Errno 21] Is a directory:
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM