简体   繁体   中英

why am i getting this IsADirectoryError: [Errno 21]?

download_images(path/file, dest, max_pics=400)


---------------------------------------------------------------------------
IsADirectoryError                         Traceback (most recent call last)
<ipython-input-16-fd768bad6ac9> in <module>()
      1 #3
----> 2 download_images(path/file, dest, max_pics=400)

2 frames
/usr/lib/python3.6/pathlib.py in open(self, mode, buffering, encoding, errors, newline)
   1181             self._raise_closed()
   1182         return io.open(str(self), mode, buffering, encoding, errors, newline,
-> 1183                        opener=self._opener)
   1184 
   1185     def read_bytes(self):

IsADirectoryError: [Errno 21] Is a directory: 'data/marvel/thor'

If data/marvel/thor is a directory, please try follows.

import os
data_paths = [os.path.join(pth, f) for pth, dirs, files in os.walk('data/marverl/thor') for f in files]
data = [download_images(f, mmap_mode='r') for f in data_paths]

You need to provide a variable/place to store each image separately.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM