[Python] Getting TypeError: cannot unpack non-iterable NoneType object for Flask(__name__)...

Discussão em 'Python' iniciado por Stack, Junho 20, 2025.

  1. Stack

    Stack Membro Participativo

    I am getting "TypeError: cannot unpack non-iterable NoneType object" while trying to run the simple flask web application.

    Code Snipet:

    from flask import Flask, redirect, url_for, render_template, request

    app = Flask(__name__)


    @app.route('/')
    def welcome_page():
    return render_template('index.html')


    @app.route('/output', methods=['GET'])
    def fetch_channel():
    if request.method == 'GET':
    channel_search = request.form.to_dict()
    channel_name = channel_search["search"]
    return render_template(
    'output.html', name = channel_name)


    if __name__ == '__main__ ':
    app.run()


    Detailed error:

    File "C:\Program Files\JetBrains\PyCharm Community Edition 2023.1.2\plugins\python-ce\helpers\pydev\_pydevd_bundle\pydevd_comm.py", line 1245, in do_it
    _typeName, val_dict = pydevd_vars.resolve_compound_variable_fields(self.thread_id, self.frame_id, self.scope, self.attributes, dbg.get_user_type_renderers())
    TypeError: cannot unpack non-iterable NoneType object```

    Continue reading...

Compartilhe esta Página