SyntaxError: invalid syntax on mflix-python/mflix/ line 274

Hallo, after following the instructions and reading the discussions I still get the following error:

File “/Users/Administrator/M220/mflix-python/mflix/api/”, line 2, in
from mflix.db import get_movie, get_movies, get_movies_by_country,
File “/Users/Administrator/M220/mflix-python/mflix/”, line 274
except (StopIteration) as _:
SyntaxError: invalid syntax

I have installed anaconda3 and the requirements.txt

SECRET_KEY = super_secret_key_you_should_change
MFLIX_DB_URI = mongodb+srv://

I would appreciate your help to get in running.
Best regards Tilo

Thanks, shifting the “except” to the try level to the left helped and it is working now. Regards Tilo


Tilo, i look that you dont have set a secret key:
SECRET_KEY = super_secret_key_you_should_change
here you can create one

1 Like

I am getting the same “invalid syntax” error. I have created a secret key and have run pip for requirements.txt. As a clarification, does the secret key just go under the [PROP] section of the .ini file? Show I use the same key under [TEST] or create a new key? Any other ideas why the syntax error might occur?


Tonight I saw one of the comments concerning the incorrect tabbing in the file. I downloaded the new version of the project and was able to continue without error.

1 Like

Hi! Where I find this version?