Unresolved attribute reference 'next' for class 'Iterable' in os.walk().next()
iterable, pycharm, python, python-2.7
Solution
Your IDE is incorrect, in Python 2 iterators (including generators like `os.walk()`) do have a `.next()` method.
You can also use the built-in `next()` function:
samples_list = next(os.walk(directory))[1]
I suspect the IDE mismatched the generator against the `collections.Iterable` ABC, while generators are `Iterator`s too.
Problem
When I'm typing something like this in PyCharm IDE 3.0.2 Community Edition (Python 2.7.x): ``` directory = '/home/user/dir' samples_list = os.walk(directory).next()[1] ``` I get warning in IDE Unresolved attribute reference 'next' for class 'Iterable'. So, I want to know if this is error because of IDE (http://youtrack.jetbrains.com/issue/PY-11401) or I should do something with my code. UPD1: Unfortunately, this is a bug in Pycharm PY-12017