I have installed tweepy on anaconda promptconda install -c conda-forge tweepy but I received below error any idea ?
import tweepy
output:
Traceback (most recent call last):
File "C:\Users\user\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 3296, in run_code exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-1-f5e4f2180e08>", line 1, in <module> import tweepy
File "C:\Users\user\Anaconda3\lib\site-packages\tweepy\__init__.py", line 17, in <module> from tweepy.streaming import Stream, StreamListener
File "C:\Users\user\Anaconda3\lib\site-packages\tweepy\streaming.py", line 358 def _start(self, async):
^
SyntaxError: invalid syntax
This GitHub issue has the answer: https://github.com/tweepy/tweepy/issues/1017#issuecomment-387703653
Essentially, async
is a reserved keyword in Python 3.7 and cannot be used as a function argument. Quoting the relevant part of the issue:
Okay found the solution. Apparently async cannot be used as an argument name in Python 3.7 So open streaming.py and replace #async with async_ it fixed the error for me.