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

Issue in user model when doing recursion of nearby_users. #152

Closed
VeNoMouS opened this Issue May 25, 2017 · 4 comments

Comments

Projects
None yet
3 participants
@VeNoMouS

VeNoMouS commented May 25, 2017

If trying to get a length of nearby_users() via len(list(self.session.nearby_users())) or sum(1 for _ in self.session.nearby_users()) we are presented with the following error..

  File "/usr/local/lib/python2.7/dist-packages/pynder-0.0.13-py2.7.egg/pynder/session.py", line 30, in nearby_users
    yield Hopeful(user, self)
  File "/usr/local/lib/python2.7/dist-packages/pynder-0.0.13-py2.7.egg/pynder/models/user.py", line 27, in __init__
    self.schools_id.extend([school["id"] for school in data['schools']])
KeyError: 'id'

@VeNoMouS VeNoMouS changed the title from Issue in user model when doing recursion over iteration of nearby_users. to Issue in user model when doing recursion of nearby_users. May 25, 2017

@VeNoMouS

This comment has been minimized.

Show comment
Hide comment
@VeNoMouS

VeNoMouS May 25, 2017

This can be resolved by adding a simple sanity check .. in pynder/models/user.py

self.schools_id.extend([school["id"] for school in data['schools'] if hasattr(school, 'id')]

VeNoMouS commented May 25, 2017

This can be resolved by adding a simple sanity check .. in pynder/models/user.py

self.schools_id.extend([school["id"] for school in data['schools'] if hasattr(school, 'id')]

@jakob400

This comment has been minimized.

Show comment
Hide comment
@jakob400

jakob400 Jun 7, 2017

I did that, but now I'm getting the errors:

Traceback (most recent call last):
  File "testapp.py", line 1, in <module>
    import pynder
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pynder/__init__.py", line 1, in <module>
    from pynder.session import Session  # NOQA
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pynder/session.py", line 6, in <module>
    from pynder.models import Profile, Hopeful, Match, Friend
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pynder/models/__init__.py", line 1, in <module>
    from pynder.models.friend import Friend  # NOQA
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pynder/models/friend.py", line 2, in <module>
    from pynder.models.user import User
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pynder/models/user.py", line 29
    self.jobs.extend(["%s @ %s" % (job["title"]["name"], job["company"]["name"]) for job in data['jobs'] if 'title' in job and 'company' in job])
       ^
SyntaxError: invalid syntax

jakob400 commented Jun 7, 2017

I did that, but now I'm getting the errors:

Traceback (most recent call last):
  File "testapp.py", line 1, in <module>
    import pynder
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pynder/__init__.py", line 1, in <module>
    from pynder.session import Session  # NOQA
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pynder/session.py", line 6, in <module>
    from pynder.models import Profile, Hopeful, Match, Friend
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pynder/models/__init__.py", line 1, in <module>
    from pynder.models.friend import Friend  # NOQA
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pynder/models/friend.py", line 2, in <module>
    from pynder.models.user import User
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pynder/models/user.py", line 29
    self.jobs.extend(["%s @ %s" % (job["title"]["name"], job["company"]["name"]) for job in data['jobs'] if 'title' in job and 'company' in job])
       ^
SyntaxError: invalid syntax
@VeNoMouS

This comment has been minimized.

Show comment
Hide comment
@VeNoMouS

VeNoMouS Jun 7, 2017

sorry missing a ) at the end.

self.schools_id.extend([school["id"] for school in data['schools'] if hasattr(school, 'id')])

VeNoMouS commented Jun 7, 2017

sorry missing a ) at the end.

self.schools_id.extend([school["id"] for school in data['schools'] if hasattr(school, 'id')])

@charliewolf

This comment has been minimized.

Show comment
Hide comment
@charliewolf

charliewolf Jun 17, 2017

Owner

fixed in master

Owner

charliewolf commented Jun 17, 2017

fixed in master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment