alexis-mignon / python-flickr-api

A python implementation of the Flickr API
BSD 3-Clause "New" or "Revised" License
367 stars 108 forks source link

iter() returned non-iterator of type #97

Closed newpro closed 5 years ago

newpro commented 6 years ago

Hey guys. Thanks very much for put together this amazing and convenient OO libraries! It saves me a lot of time in my research.

The walker iter function return itself instead of the list, this causes the titled error raised. An example is given as the following code:

walker = flickr_api.Walker(flickr_api.Photo.search, text='football')
for p in walker:
    print (p.title)

# raise error: TypeError: iter() returned non-iterator of type 'Walker'

A relative read of the issue is here.

Cheers!

mtrovo commented 6 years ago

Could you share which version of python are you using?

As you can see on the code that you linked the iterator contract is already being implemented and locally testing on Python 3 I can see that it's really working for me.

newpro commented 6 years ago

hey @mtrovo , thx for reply!

I digged a little bit, you are right, the implementation should work for python 3, all it need to iterate is init, iter and next. I try clone directly from master, it works fine, same for direct downloading from release version(0.6.1). However, if I directly pip it, and went into system package directory, I notice pip gives me a version that does not have next redirect to next(). Which I assume causes the above problem.

I am using pip within conda, I am not sure if it actually download package differently from normal pip. The system info are as following:

print(sys.version) 3.6.5 |Anaconda, Inc.| (default, Apr 29 2018, 16:14:56) [GCC 7.2.0]

Cheers!

mtrovo commented 5 years ago

I released a new version of the library, if could try using the new version. I will mark this issue as solved but feel free to reopen if you still have any problems.