Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: object of type 'map' has no len() #588

Closed
ghost opened this issue Apr 12, 2015 · 22 comments
Closed

TypeError: object of type 'map' has no len() #588

ghost opened this issue Apr 12, 2015 · 22 comments

Comments

@ghost
Copy link

ghost commented Apr 12, 2015

So I updated my PSA since I was told we had made adjustments in relation to just some warnings coming around the bend with django 1.9 and then this happened so I wanted to drop it here in case it was of value. It appears something else has gone wrong:

(athletesunited)JJs-MacBook-Pro:athletesunited JJZ$ python manage.py runserver localhost:8000
/Users/JJZ/.virtualenvs/athletesunited/lib/python3.4/importlib/_bootstrap.py:321: RemovedInDjango19Warning: The utilities in django.db.models.loading are deprecated in favor of the new application loading system.
return f(_args, *_kwds)

Traceback (most recent call last):
File "manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/Users/JJZ/.virtualenvs/athletesunited/lib/python3.4/site-packages/django/core/management/init.py", line 338, in execute_from_command_line
utility.execute()
File "/Users/JJZ/.virtualenvs/athletesunited/lib/python3.4/site-packages/django/core/management/init.py", line 312, in execute
django.setup()
File "/Users/JJZ/.virtualenvs/athletesunited/lib/python3.4/site-packages/django/init.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Users/JJZ/.virtualenvs/athletesunited/lib/python3.4/site-packages/django/apps/registry.py", line 108, in populate
app_config.import_models(all_models)
File "/Users/JJZ/.virtualenvs/athletesunited/lib/python3.4/site-packages/django/apps/config.py", line 198, in import_models
self.models_module = import_module(models_module_name)
File "/Users/JJZ/.virtualenvs/athletesunited/lib/python3.4/importlib/init.py", line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 2254, in _gcd_import
File "", line 2237, in _find_and_load
File "", line 2226, in _find_and_load_unlocked
File "", line 1200, in _load_unlocked
File "", line 1129, in _exec
File "", line 1471, in exec_module
File "", line 321, in _call_with_frames_removed
File "/Users/JJZ/.virtualenvs/athletesunited/lib/python3.4/site-packages/social/apps/django_app/default/models.py", line 9, in
from social.storage.django_orm import DjangoUserMixin,
File "/Users/JJZ/.virtualenvs/athletesunited/lib/python3.4/site-packages/social/storage/django_orm.py", line 5, in
from social.storage.base import UserMixin, AssociationMixin, NonceMixin,
File "/Users/JJZ/.virtualenvs/athletesunited/lib/python3.4/site-packages/social/storage/base.py", line 12, in
from openid.association import Association as OpenIdAssociation
File "/Users/JJZ/.virtualenvs/athletesunited/lib/python3.4/site-packages/openid/init.py", line 52, in
if len(version_info) != 3:
TypeError: object of type 'map' has no len()

@kyleconroy
Copy link

I just ran into this problem as well

PSA: 0.2.4
Django: 1.8

$ python manage.py runserver
Traceback (most recent call last):
  File "manage.py", line 26, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/kyle/projects/speakers/env/lib/python3.4/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
    utility.execute()
  File "/Users/kyle/projects/speakers/env/lib/python3.4/site-packages/django/core/management/__init__.py", line 312, in execute
    django.setup()
  File "/Users/kyle/projects/speakers/env/lib/python3.4/site-packages/django/__init__.py", line 18, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/Users/kyle/projects/speakers/env/lib/python3.4/site-packages/django/apps/registry.py", line 108, in populate
    app_config.import_models(all_models)
  File "/Users/kyle/projects/speakers/env/lib/python3.4/site-packages/django/apps/config.py", line 198, in import_models
    self.models_module = import_module(models_module_name)
  File "/Users/kyle/projects/speakers/env/lib/python3.4/importlib/__init__.py", line 109, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
  File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
  File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1129, in _exec
  File "<frozen importlib._bootstrap>", line 1471, in exec_module
  File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
  File "/Users/kyle/projects/speakers/env/lib/python3.4/site-packages/social/apps/django_app/default/models.py", line 9, in <module>
    from social.storage.django_orm import DjangoUserMixin, \
  File "/Users/kyle/projects/speakers/env/lib/python3.4/site-packages/social/storage/django_orm.py", line 5, in <module>
    from social.storage.base import UserMixin, AssociationMixin, NonceMixin, \
  File "/Users/kyle/projects/speakers/env/lib/python3.4/site-packages/social/storage/base.py", line 12, in <module>
    from openid.association import Association as OpenIdAssociation
  File "/Users/kyle/projects/speakers/env/lib/python3.4/site-packages/openid/__init__.py", line 52, in <module>
    if len(version_info) != 3:
TypeError: object of type 'map' has no len()

@tutuca
Copy link

tutuca commented Apr 12, 2015

Release was last night.

It's broken here too. It's weird because IIRC python-openid wasn't required to use PSA and shouldn't pull it by default.

@ghost
Copy link
Author

ghost commented Apr 12, 2015

Yeah that's what I am saying. I had pulled the newest release which is yes 0.2.4 and I tried to run the server and it bombed out, the server will not run. And yes it looks like something with open ID so maybe we weren't expecting this as much like tutuca said.

@yprez
Copy link
Contributor

yprez commented Apr 12, 2015

Ran into this too...
Looks like, for some reason, when installing from PyPI on Python3 it installs python-openid instead of python3-openid...
When installing from github, or from a local version, it does get the correct version (python3-openid).

@ghost
Copy link
Author

ghost commented Apr 12, 2015

Oh yprez did that do it? Did installing python3-openid do it? I did some research and it did seem like a python3 thing. Basically you had to handle the mapping slightly differently.

@yprez
Copy link
Contributor

yprez commented Apr 12, 2015

I checked and after uninstalling python-openid and installing python3-openid manually, it worked. Before that I had problems with it, maybe because of clashes between the 2 openid versions.

The weird thing is that when you do pip install git+https://github.com/omab/python-social-auth.git, it installs python3-openid properly...

@ghost
Copy link
Author

ghost commented Apr 12, 2015

Yeah you are correct, after uninstalling python-openid and installing python3-openid everything worked out as expected and the server funs fine. I just installed python3-openid directly so pip install python3-openid instead of using PSA because when I first tried that it still installed python-openid instead.

@h8
Copy link

h8 commented Apr 12, 2015

Same here - after installing latest version with Pip it also installs python-openid instead of installing python3-openid. Python version 3.4.0.

omab added a commit that referenced this issue Apr 13, 2015
@omab
Copy link
Owner

omab commented Apr 13, 2015

I've released v0.2.5 which solves this issue, the problem was caused by the recently introduced wheel support, but the packages built was broken (Python 2 dependencies defined in the a single universal wheel), I've fixed it b building version-dependent wheels now.

@omab omab closed this as completed Apr 13, 2015
@tutuca
Copy link

tutuca commented Apr 13, 2015

Thanks!

@ngavrish
Copy link

Still have this issue with latest from pip and Python 3.4

It somehow falls into opened instead of python3-openid
File "/Users/802619/Envs/nucase/lib/python3.4/site-packages/openid/init.py", line 52, in
if len(version_info) != 3:

@ngavrish
Copy link

Obviously even I fix this by wrapping map in the list, I run into bunch of another issues

@iampbernardo
Copy link

Still same problem here
Python 3.4

@TristanH
Copy link

+1 to issue still existing with Python 3.4

@masroore
Copy link

masroore commented Mar 5, 2016

Python 3.5.1. issue still existing.

@guinslym
Copy link

guinslym commented Jun 14, 2016

Works great with 3.4. I just had to upgrade the package
pip install -U python-social-auth

@neelshah16
Copy link

I still have the same issue, python 3.6

@akhilrs
Copy link

akhilrs commented Oct 2, 2017

Upgrading python3-openid solved the issue on python 3.6
pip3 install python3-openid --upgrade

@omab
Copy link
Owner

omab commented Jan 28, 2018

@Rokrishna9

  1. It's better to propose a fix than demand one
  2. This library is deprecated since December 2016

@vinpalace
Copy link

I've fixed it by uninstalling all the openid packages present and the module I was using. In this case it was social-auth-app-django

pip uninstall python-openid
pip uninstall python3-openid

Then reinstalled the module which sorted out the correct dependency order.

@palewire
Copy link

palewire commented Dec 2, 2019

Issue is still with us!

@shukhrat211
Copy link

I have fixed it by uninstalling pip uninstall python-openid, and pip uninstall python3-openid then install both pip install python-openid and pip install python3-openid, but social-auth still not work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests