Traceback Syntax error in run.py

When I run python run.py, I get:

 File "run.py", line 1, in <module>
   from mflix.factory import create_app
 File "/home/vishal/Documents/MongoDB/M220_MongoDB_for_Python/mflix-python/mflix/factory.py", line 12, in <module>
   from mflix.api.movies import movies_api_v1
 File "/home/vishal/Documents/MongoDB/M220_MongoDB_for_Python/mflix-python/mflix/api/movies.py", line 2, in <module>
   from mflix.db import get_movie, get_movies, get_movies_by_country, \
 File "/home/vishal/Documents/MongoDB/M220_MongoDB_for_Python/mflix-python/mflix/db.py", line 274
   except (StopIteration) as _:
        ^
SyntaxError: invalid syntax ```

I have imported the Data and installed requirements.txt without any error at all.

Try to shift except to the try level to the left

1 Like

replace the tabs in rows 269, 274 and 284 with spaces and make sure you keep the indentation at the right levels

1 Like

Thanks, I had the same error and shifting except to the try level to the left was my solution. Best regards Tilo

Thanks - I had this issue and this fixed it.