Skip to content

Cannot Instantiate Quart object with Flask==3.1.0 #371

Closed
@biniona

Description

@biniona

Unable to instantiate Quart object with Flask==3.1.0.

Run the following code from terminal:

pip install quart

Run the following code:

from quart import Quart

Quart(__name__)

Outputs the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File ".../.pyenv/lib/python3.11/site-packages/quart/app.py", line 338, in __init__
    self.add_url_rule(
  File ".../.pyenv/lib/python3.11/site-packages/flask/sansio/scaffold.py", line 47, in wrapper_func
    return f(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../.pyenv/lib/python3.11/site-packages/flask/sansio/app.py", line 641, in add_url_rule
    if "OPTIONS" not in methods and self.config["PROVIDE_AUTOMATIC_OPTIONS"]:
                                    ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'PROVIDE_AUTOMATIC_OPTIONS'

Output of pip freeze:

aiofiles==24.1.0
blinker==1.9.0
click==8.1.7
Flask==3.1.0
h11==0.14.0
h2==4.1.0
hpack==4.0.0
Hypercorn==0.17.3
hyperframe==6.0.1
itsdangerous==2.2.0
Jinja2==3.1.4
MarkupSafe==3.0.2
priority==2.0.0
Quart==0.19.8
Werkzeug==3.1.3
wsproto==1.2.0

Installing Flask==3.0.0 fixes the issue:

The expected behavior is a successful instantiation of a Quart object.

Environment:

  • Python version: 3.11.3
  • Flask version: 3.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions