You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am getting this error the same issue was closed but it worked on Windows.
I am using the recent Twitter API.
/Users/apple/project/Mining-twitter-data-with-pyth
on/Tweet/my_env/bin/python /Users/apple/project/Mining-twitter-data-with-python/Tweet/tw
itter_get_home_timeline.py
Traceback (most recent call last):
File "/Users/apple/project/Mining-twitter-data-with-python/Tweet/twitter_get_home_timeline.py", line 14, in
from twitter_client import get_twitter_client
File "/Users/apple/project/Mining-twitter-data-with-python/Tweet/twitter_client.py", line 11, in
from tweepy import API
ImportError: cannot import name 'API' from 'tweepy' (unknown location)
The text was updated successfully, but these errors were encountered:
Hi @Tarandeepsingh436 you might be experiencing different issues.
Firstly, please be aware that the code here supports the old Twitter API v1, so if you're using the latest v2 things simply won't work out of the box, loads of things have changed since this book came out in 2016. You may want to explore how tweepy supports the new API version and customise your code accordingly (https://docs.tweepy.org/en/stable/install.html) but I can't offer much advice there.
If you're working with the Twitter API v1 instead, you can use the code here but there are a couple more things to check:
Please make sure you don't have a file called tweepy.py in that same folder, that might cause import issues.
Also make sure to activate the Python virtual environment correctly, and run it from the source code folder, e.g. simply:
python twitter_get_home_timeline.py
On Mac you can check which Python interpreter you're running with:
Hi I am using a 2020 mac book air
I am getting this error the same issue was closed but it worked on Windows.
I am using the recent Twitter API.
/Users/apple/project/Mining-twitter-data-with-pyth
on/Tweet/my_env/bin/python /Users/apple/project/Mining-twitter-data-with-python/Tweet/tw
itter_get_home_timeline.py
Traceback (most recent call last):
File "/Users/apple/project/Mining-twitter-data-with-python/Tweet/twitter_get_home_timeline.py", line 14, in
from twitter_client import get_twitter_client
File "/Users/apple/project/Mining-twitter-data-with-python/Tweet/twitter_client.py", line 11, in
from tweepy import API
ImportError: cannot import name 'API' from 'tweepy' (unknown location)
The text was updated successfully, but these errors were encountered: