This is the code that I use to access Stack Overflow:

from stackexchange import Site, StackOverflow
so = stackexchange.StackOverflow()
for q in so.questions(pagesize=50):
    print q.title

It runs fine when I copy and paste it on the command shell. But running it in IDLE gives the following error:

Traceback (most recent call last):
  File "C:\Users\Animesh\Desktop\NLP\metastack.py", line 3, in <module>
    from stackexchange import Site, StackOverflow
  File "C:\Users\Animesh\Desktop\stackexchange.py", line 4, in <module>
AttributeError: 'module' object has no attribute 'StackOverflow'

How should I correct it?

  • Do you have a stackexchange.py file in your local directory? Test with import stackexchange; print stackexchange.__file__`. Mar 6, 2013 at 16:28
  • Which Python wrapper are you using? Mar 9, 2013 at 4:54


You must log in to answer this question.

Browse other questions tagged .