属性错误: 'generator'对象没有属性'next'



使用python 3.6,我从 tflearn.data_utils

导入 image_preloader

我写

X, Y = image_preloader("\all\train", image_shape=(128, 128), mode='folder', categorical_labels=True, normalize=True)

train文件夹内有标签的文件夹。这些标记的文件夹是图像。

我得到此错误:

    C:UsersDaman.condaenvsTFpython.exe 
    "C:/Users/Daman/PycharmProjects/Coin Classification/main.py"
    hdf5 is not supported on this machine (please install/reinstall h5py for                         
    optimal experience)
    curses is not supported on this machine (please install/reinstall curses                 
    for an optimal experience)
    Scipy not supported!
    Traceback (most recent call last):
      File "C:UsersDaman.condaenvsTFlibsite-
    packagestflearndata_utils.py", line 730, in directory_to_samples
        classes = sorted(os.walk(directory).next()[1])
    AttributeError: 'generator' object has no attribute 'next'
    During handling of the above exception, another exception occurred:
    Traceback (most recent call last):
      File "C:/Users/Daman/PycharmProjects/Coin Classification/main.py", line 
    3, in <module>
        X, Y = image_preloader("\all\train", image_shape=(640,480), 
    mode='folder', categorical_labels=True, normalize=True)
      File "C:UsersDaman.condaenvsTFlibsite-
    packagestflearndata_utils.py", line 512, in image_preloader
        flags=files_extension, filter_channel=filter_channel)
      File "C:UsersDaman.condaenvsTFlibsite-
    packagestflearndata_utils.py", line 732, in directory_to_samples
         classes = sorted(os.walk(directory).__next__()[1])
    StopIteration

如何解决此错误?

我正在处理相同的问题, g.next((由Python 2支持,现在您可以使用 next(g( Python 3

最新更新