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

Fixed "KeyError None" #29

Closed
wants to merge 2 commits into from

Conversation

Turochamp
Copy link
Contributor

Hi @antonplagemann
When doing full sync a few of my contacts failed with the error: "Script aborted: KeyError: None". The cause is an assumption in the code that genderType never is null, something this change fixes.

I do now know why these contacts' gender was null. They look perfectly fine in Monica.

Comment on lines +547 to +551
if genderType == None:
genderId = None
else:
genderId = monica.getGenderMapping()[genderType]

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should also work and it's a bit shorter 😃
Can you confirm this?

Suggested change
if genderType == None:
genderId = None
else:
genderId = monica.getGenderMapping()[genderType]
genderId = monica.getGenderMapping().get(genderType, None)

@antonplagemann
Copy link
Owner

Hi @Turochamp
first, thanks for your contribution!
I didn't realize that there is also a secret Null gender ID which stands for No gender 😄
This is a bit unintuitive for me as the Monica API documentation says that a gender ID is required, so I thought setting it to None won't work 😃

@antonplagemann antonplagemann added the bug Something isn't working label Oct 1, 2021
@Turochamp Turochamp deleted the branch antonplagemann:development December 9, 2021 14:34
@Turochamp Turochamp closed this Dec 9, 2021
@Turochamp Turochamp deleted the development branch December 9, 2021 14:34
antonplagemann added a commit that referenced this pull request Dec 9, 2021
Co-authored-by: Michael Åhs <michael.ahs@vipps.no>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants