question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Intial Server run is throwing TypeError: cannot unpack non-iterable EnumChoices object

See original GitHub issue
  1. Just pulled a repo & installed requirements.txt in virtualenv
  2. gettting below error when I’m starting the app

### The Error:

Traceback (most recent call last): File "/Users/tusharniras/Desktop/sanbox/flask-admin/examples/sqla/run_server.py", line 1, in <module> from admin import app File "/Users/tusharniras/Desktop/sanbox/flask-admin/examples/sqla/admin/__init__.py", line 24, in <module> import admin.main File "/Users/tusharniras/Desktop/sanbox/flask-admin/examples/sqla/admin/main.py", line 248, in <module> admin.add_view(UserAdmin(User, db.session)) File "/Users/tusharniras/Desktop/sanbox/flask-admin/venv/lib/python3.9/site-packages/flask_admin/contrib/sqla/view.py", line 327, in __init__ super(ModelView, self).__init__(model, name, category, endpoint, url, static_folder, File "/Users/tusharniras/Desktop/sanbox/flask-admin/venv/lib/python3.9/site-packages/flask_admin/model/base.py", line 818, in __init__ self._refresh_cache() File "/Users/tusharniras/Desktop/sanbox/flask-admin/venv/lib/python3.9/site-packages/flask_admin/model/base.py", line 910, in _refresh_cache self._refresh_forms_cache() File "/Users/tusharniras/Desktop/sanbox/flask-admin/venv/lib/python3.9/site-packages/flask_admin/model/base.py", line 835, in _refresh_forms_cache self._create_form_class = self.get_create_form() File "/Users/tusharniras/Desktop/sanbox/flask-admin/venv/lib/python3.9/site-packages/flask_admin/model/base.py", line 1291, in get_create_form return self.get_form() File "/Users/tusharniras/Desktop/sanbox/flask-admin/venv/lib/python3.9/site-packages/flask_admin/model/base.py", line 1248, in get_form return self.scaffold_form() File "/Users/tusharniras/Desktop/sanbox/flask-admin/venv/lib/python3.9/site-packages/flask_admin/contrib/sqla/view.py", line 745, in scaffold_form form_class = form.get_form(self.model, converter, File "/Users/tusharniras/Desktop/sanbox/flask-admin/venv/lib/python3.9/site-packages/flask_admin/contrib/sqla/form.py", line 552, in get_form field = converter.convert(model, mapper, name, prop, field_args.get(name), hidden_pk) File "/Users/tusharniras/Desktop/sanbox/flask-admin/venv/lib/python3.9/site-packages/flask_admin/contrib/sqla/form.py", line 263, in convert return converter(model=model, mapper=mapper, prop=prop, File "/Users/tusharniras/Desktop/sanbox/flask-admin/venv/lib/python3.9/site-packages/flask_admin/contrib/sqla/form.py", line 307, in convert_choice_type accepted_values = [key for key, val in available_choices] File "/Users/tusharniras/Desktop/sanbox/flask-admin/venv/lib/python3.9/site-packages/flask_admin/contrib/sqla/form.py", line 307, in <listcomp> accepted_values = [key for key, val in available_choices] TypeError: cannot unpack non-iterable EnumChoices object

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:11
  • Comments:10

github_iconTop GitHub Comments

3reactions
mihemihecommented, Jun 6, 2021

Same error here after tried two times from scratch. To reproduce the issue:

virtualenv env -p python3 source env/bin/activate pip install -r examples/sqla/requirements.txt python3 examples/sqla/run_server.py

Traceback (most recent call last): File “/home/mihe/fa/flask-admin/examples/sqla/run_server.py”, line 1, in <module> from admin import app File “/home/mihe/fa/flask-admin/examples/sqla/admin/init.py”, line 24, in <module> import admin.main File “/home/mihe/fa/flask-admin/examples/sqla/admin/main.py”, line 248, in <module> admin.add_view(UserAdmin(User, db.session)) File “/home/mihe/fa/flask-admin/env/lib/python3.9/site-packages/flask_admin/contrib/sqla/view.py”, line 327, in init super(ModelView, self).init(model, name, category, endpoint, url, static_folder, File “/home/mihe/fa/flask-admin/env/lib/python3.9/site-packages/flask_admin/model/base.py”, line 818, in init self._refresh_cache() File “/home/mihe/fa/flask-admin/env/lib/python3.9/site-packages/flask_admin/model/base.py”, line 910, in _refresh_cache self._refresh_forms_cache() File “/home/mihe/fa/flask-admin/env/lib/python3.9/site-packages/flask_admin/model/base.py”, line 835, in _refresh_forms_cache self._create_form_class = self.get_create_form() File “/home/mihe/fa/flask-admin/env/lib/python3.9/site-packages/flask_admin/model/base.py”, line 1291, in get_create_form return self.get_form() File “/home/mihe/fa/flask-admin/env/lib/python3.9/site-packages/flask_admin/model/base.py”, line 1248, in get_form return self.scaffold_form() File “/home/mihe/fa/flask-admin/env/lib/python3.9/site-packages/flask_admin/contrib/sqla/view.py”, line 745, in scaffold_form form_class = form.get_form(self.model, converter, File “/home/mihe/fa/flask-admin/env/lib/python3.9/site-packages/flask_admin/contrib/sqla/form.py”, line 552, in get_form field = converter.convert(model, mapper, name, prop, field_args.get(name), hidden_pk) File “/home/mihe/fa/flask-admin/env/lib/python3.9/site-packages/flask_admin/contrib/sqla/form.py”, line 263, in convert return converter(model=model, mapper=mapper, prop=prop, File “/home/mihe/fa/flask-admin/env/lib/python3.9/site-packages/flask_admin/contrib/sqla/form.py”, line 307, in convert_choice_type accepted_values = [key for key, val in available_choices] File “/home/mihe/fa/flask-admin/env/lib/python3.9/site-packages/flask_admin/contrib/sqla/form.py”, line 307, in <listcomp> accepted_values = [key for key, val in available_choices] TypeError: cannot unpack non-iterable EnumChoices object

2reactions
Ma27commented, Jul 22, 2021

It seems as the issue gets fixed by downgrading SQLAlchemy-Utils to 0.36.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: cannot unpack non-iterable NoneType object
A common cause of this error is when you try to unpack values from a function that does not return a value.
Read more >
TypeError: cannot unpack non-iterable NoneType object
You get this error when you perform a multiple assignment to None (which is of NoneType ). For instance: X_train, y_train, X_test, y_test...
Read more >
Typeerror: cannot unpack non-iterable nonetype object
This error mainly happens when you try to assign an object with a None type to a set of individual variables. This may...
Read more >
Python TypeError: cannot unpack non-iterable NoneType object
In Python, TypeError is subclass of Exception. Python sequence can be unpacked. This means you can assign content of sequence to multiple ...
Read more >
Groovy Language Documentation
Command-line Options and Arguments; Running Scripts; Editing Files ... String if there's no interpolated expression, but are groovy.lang.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found