lucjon / Py-StackExchange

A Python binding for the StackExchange API
http://stackapps.com/questions/198/py-stackexchange-an-api-wrapper-for-python
BSD 3-Clause "New" or "Revised" License
229 stars 76 forks source link

'Site' object has no attribute 'search_advanced' for some mac users #33

Open lukasschwab opened 9 years ago

lukasschwab commented 9 years ago

This is an extension of an issue on stackit, a project I built using the Py-StackExchange wrapper.

Our pip install process automatically installs Py-StackExchange, equivalent to running pip install Py-StackExchange at the command line. However, when using our code, this error is produced, but only for some users: AttributeError: 'Site' object has no attribute 'search_advanced'.

At the hackathon where we built stackit, we solved the problem by cloning and modifying Py-StackExchange's setup.py; the modified version is in this gist. That manual installation and modification has worked so far, but is a clunky solution for our users.

I suspect that this has something to do with the Python versions found on each computer, and am perplexed that this functionality would be removed for a user that can ultimately compile and run it in their environment once they've modified setup.py.

Also, this project was a life-saver––heartfelt "thank you" from team Baby Got Stack!

lucjon commented 9 years ago

Thanks for reporting this. I must admit I'm having trouble reproducing the problem, although I imagine that that has more to do with peculiarities of my setup than with your users'. I did notice that the version I obtained manually from PyPI was actually old enough that it did not contain the advanced_search method — though I do then wonder how installing through pip worked at all!

I have pushed a new version to PyPI which does include the new method. If you still have a means of reproducing the problem, I would be very grateful if you could see if it persists.

If it does persist, would you be able to confirm that the setup.py modifications are necessary to make it work again? I'm reluctant to remove the Python 2.6 classification globally since it is still a supported target for the library — but then again, if it's causing the problem, I will certainly need to do some more digging.

Thanks, Lucas

lukasschwab commented 9 years ago

Yes, this problem persists even when manually installing from the code in this Github repo.

I am running out of the stock Terminal on OS X 10.10 Yosemite. I have Python 2.6 and Python 2.7 installed on this machine. Python 2.7.6 is the default.

I'm not sure how to determine whether setup.py modifications are necessary; if I were to take a guess, I'd say that setup.py probably detects Python 2.6 on my machine and installs accordingly, which means it doesn't include the new API methods in the install. What do you think?

I can do some further digging, but this is on my backburner (at least for the next couple of days).

Thanks!