TypeError: __init__() got an unexpected keyword argument 'unbound_message'

Hi,

I have followed the steps given in the chapter to set up mflix app. After completing all the procedure, the following error was thrown while running run.py
TypeError: init() got an unexpected keyword argument ‘unbound_message’

Please help me to resolve it.

1 Like

Hey @Khaleel_Ahamed,

Welcome to the MongoDB Community Forums! :dizzy:

In order to better help you out, we would need more details. Can you please let us know the python version you are setting up the mflix with(we recommend 3.8), the OS you are using, the full error message log you are getting as well as share your .ini file contents? Also, kindly let us know whether you are setting up using a virtual environment or Anaconda.

Regards,
Satyam

1 Like

Python 3.9.12
Windows 11

.ini file content

# Ticket: Connection
# Rename this file to .ini after filling in your MFLIX_DB_URI and your SECRET_KEY
# Do not surround the URI with quotes

[PROD]
SECRET_KEY = super_secret_key_you_should_change
MFLIX_DB_URI = mongodb+srv://m220student:m220password@mflix.heaoxjz.mongodb.net/?retryWrites=true&w=majority
MFLIX_NS = sample_mflix

[TEST]
SECRET_KEY = super_secret_testing_key
MFLIX_DB_URI = mongodb+srv://m220student:m220password@mflix.heaoxjz.mongodb.net/?retryWrites=true&w=majority
MFLIX_NS = sample_mflix

Error Message

Traceback (most recent call last):
  File "C:\Users\omdkh\Downloads\mflix-python\run.py", line 1, in <module>
    from mflix.factory import create_app
  File "C:\Users\omdkh\Downloads\mflix-python\mflix\factory.py", line 3, in <module>
    from flask import Flask, render_template
  File "C:\Users\omdkh\anaconda3\lib\site-packages\flask\__init__.py", line 4, in <module>
    from . import json as json
  File "C:\Users\omdkh\anaconda3\lib\site-packages\flask\json\__init__.py", line 8, in <module>
    from ..globals import current_app
  File "C:\Users\omdkh\anaconda3\lib\site-packages\flask\globals.py", line 56, in <module>
    app_ctx: "AppContext" = LocalProxy(  # type: ignore[assignment]
TypeError: __init__() got an unexpected keyword argument 'unbound_message'

Using Anaconda

Hey @Khaleel_Ahamed,

From the error message, it seems that this issue is more related to the flask version.
Have all packages been installed as per the requirements.txt file? Kindly use the following command to list all the packages and see if they have been rightly installed or not as per the requirements.txt file:

python3 -m pip freeze

or you can simply see the list of packages installed for your Anaconda Environment by going to Environments in the Anaconda Navigator.

Regards,
Satyam

1 Like

I’m still getting this issue. Here’s my error message:

Traceback (most recent call last):
  File "run.py", line 1, in <module>
    from mflix.factory import create_app
  File "/Users/nicoaddai/Downloads/mflix-python/mflix/factory.py", line 3, in <module>
    from flask import Flask, render_template
  File "/Users/nicoaddai/Downloads/mflix-python/venv/lib/python3.8/site-packages/flask/__init__.py", line 4, in <module>
    from . import json as json
  File "/Users/nicoaddai/Downloads/mflix-python/venv/lib/python3.8/site-packages/flask/json/__init__.py", line 8, in <module>
    from ..globals import current_app
  File "/Users/nicoaddai/Downloads/mflix-python/venv/lib/python3.8/site-packages/flask/globals.py", line 56, in <module>
    app_ctx: "AppContext" = LocalProxy(  # type: ignore[assignment]
TypeError: __init__() got an unexpected keyword argument 'unbound_message'