Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'module' object has no attribute 'Twitter'

Tags:

python

twitter

I am trying to follow the example on page 5 of the book: Mining the Social Web, from O'Reilly. I am coming across the following error:

>>> import twitter
>>> twitter_api = twitter.Twitter(domain="api.twitter.com", api_version='1')
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: 'module' object has no attribute 'Twitter'

What might be going on?

like image 806
jason Avatar asked Feb 24 '23 07:02

jason


1 Answers

Check the value of twitter.__file__ (after you've imported twitter). My guess is either you somehow got a broken version of twitter, or you've created a file called twitter.py in the same directory you're running from that's blocking the installed module from loading.

If twitter.__file__ looks good (points to where your installed modules should be instead of the local dir), try easy_install -U twitter to reinstall it.

like image 150
Mu Mind Avatar answered Feb 26 '23 20:02

Mu Mind