0

There has been this constant error while trying to run my code and i'm unable to understand what it means and how to make it right.

C:\code\sentimentanalysis\venv\sentiment analysis\Scripts\python.exe" C:/code/sentimentanalysis/main.py Traceback (most recent call last):
File "C:/code/sentimentanalysis/main.py", line 1, in import sys,tweepy,csv,re File "C:\Users\Vermaaka\AppData\Local\Programs\Python\Python37\lib\site-packages\tweepy__init__.py", line 17, in from tweepy.streaming import Stream, StreamListener File "C:\Users\Vermaaka\AppData\Local\Programs\Python\Python37\lib\site-packages\tweepy\streaming.py", line 358 def _start(self, async): ^ SyntaxError: invalid syntax

Process finished with exit code 1


I have already installed all the packages before starting with this project. Please help.

Rakesh
  • 81,458
  • 17
  • 76
  • 113
  • Are you using python 3.7? If so, try using python 3.5? (Most modules are written for python 3.5, as python 3.7 is not officially released yet). The error indicates syntax error in streaming.py in the Tweepy package. This might be due to python 3.7? – Fabian Ying Jul 20 '18 at 11:30
  • Hi, thankyou so much for replying. I uninstalled Python 3.7 and installed Python 3.4. I added the path ans path variable for the same and deleted the previous variables and path. However, now by running my code it shows: "C:\code\sentimentanalysis\venv\sentiment analysis\Scripts\python.exe" C:/code/sentimentanalysis/main.py Fatal Python error: initfsencoding: unable to load the file system codec ModuleNotFoundError: No module named 'encodings' Current thread 0x00002f6c (most recent call first): Process finished with exit code -1073740791 (0xC0000409) – Akanksha Verma Jul 23 '18 at 07:23

1 Answers1

1

async is a reserved keyword from Python 3.7, which is why it raises a SyntaxError.

You should use python 3.6 (or lower) with Tweepy.

Python 3.7 is not supported by Tweepy.

Fabian Ying
  • 1,216
  • 1
  • 10
  • 15
  • Hi, thankyou so much for replying. I uninstalled Python 3.7 and installed Python 3.4. I added the path ans path variable for the same and deleted the previous variables and path. However, now by running my code it shows: "C:\code\sentimentanalysis\venv\sentiment analysis\Scripts\python.exe" C:/code/sentimentanalysis/main.py Fatal Python error: initfsencoding: unable to load the file system codec ModuleNotFoundError: No module named 'encodings' Current thread 0x00002f6c (most recent call first): Process finished with exit code -1073740791 (0xC0000409) – Akanksha Verma Jul 23 '18 at 07:22
  • Can I share my code with you maybe and could you try running it on your system. I've been stuck with this since days now. – Akanksha Verma Jul 23 '18 at 07:25
  • This is a different error. It says that python cannot find a module named `encodings` installed. Maybe try what they suggest in [here](https://stackoverflow.com/questions/38132755/importerror-no-module-named-encodings). – Fabian Ying Jul 23 '18 at 11:00