i'm trying to execute this python script :
#! /usr/bin/python
import stackexchange
so = stackexchange.Site(stackexchange.StackOverflow)
my_favourite_guy = so.user(41981)
print my_favourite_guy.reputation.format()
print len(my_favourite_guy.answers), 'answers'
But i got this error
Jarvis:Documents Adeel$ python stackexchange.py
Traceback (most recent call last):
File "stackexchange.py", line 3, in <module>
import stackexchange
File "/Users/Adeel/Documents/stackexchange.py", line 5, in <module>
so = stackexchange.Site(stackexchange.StackOverflow)
AttributeError: 'module' object has no attribute 'Site'
It works fine when I copy and paste it on the python shell :
Jarvis:~ Adeel$ python
Python 2.7.5 (default, Aug 25 2013, 00:04:04)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import stackexchange
>>> so = stackexchange.Site(stackexchange.StackOverflow)
>>> my_favourite_guy = so.user(41981)
>>> print my_favourite_guy.reputation.format()
11.2k
>>> print len(my_favourite_guy.answers), 'answers'
239 answers
I don't understand why..can anyone help me ?