Reputation: 59
Keep getting this error and not sure why,
exceptions.ImportError: cannot import name TwitterAPI
TwitterAPI library is already downloaded, I download it first from pip install twitterapi, didnt work, uninstall it and download the .zip file for it, and tried to install it using
python setup.py build
python setup.py install
didnt work too, still getting the same error, any ideas?
the code:
from TwitterAPI import TwitterAPI
TRACK_TERM = 'NBA'
api = TwitterAPI(consumer_key='__', consumer_secret='__', access_token_key='__', access_token_secret='__')
r = api.request('statuses/filter', {'track': TRACK_TERM})
for item in r:
print (item['text'] if 'text' in item else item)
Upvotes: 1
Views: 1828
Reputation: 334
You should to install requests (or upgrade them) like in this issue.
pip install requests
or
pip install --upgrade requests
Upvotes: 0
Reputation: 4058
Because you installed TwitterAPI from a zip file, the package is not necessarily in a path where Python will see it. That is why import fails. Your best bet is to try installing with pip again, but this time use the proper case since pip is case sensitive:
pip install TwitterAPI
Upvotes: 0