Skip to content

Fix KeyError in image folder view in Stage 5.3#58

Merged
jonathanrocher merged 1 commit intomasterfrom
fix/key_error_crash
Jul 11, 2022
Merged

Fix KeyError in image folder view in Stage 5.3#58
jonathanrocher merged 1 commit intomasterfrom
fix/key_error_crash

Conversation

@siddhantwahal
Copy link
Copy Markdown
Collaborator

@siddhantwahal siddhantwahal commented Jul 9, 2022

To reproduce:

  1. Launch the app from Stage 5.3
  2. Double click on the ets_tutorial/ets_tutorial/sample_images in the browser pane
  3. Click "Scan for faces"
  4. App crashes with KeyError: "Make".

That's because computing faces updates all_data but neglects to add missing columns to it.

Comment on lines +129 to +132
def parse_year(x):
return x.split(":")[0] if isinstance(x, str) else "unknown"
data[YEAR_KEY] = data[DATETIME_COL].apply(parse_year)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This isn't necessary to fix the bug but I accidentally included it in this commit. I'll let it be here because all missing columns are now added in one place so it's slightly easier to follow.

def _filtered_data_default(self):
return self.all_data

def _all_years_default(self):
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This and filtered_data could be properties, but this is OK too.

@siddhantwahal siddhantwahal changed the title Fix key errors in image folder view in Stage 5.3 Fix KeyError in image folder view in Stage 5.3 Jul 9, 2022
Copy link
Copy Markdown
Owner

@jonathanrocher jonathanrocher left a comment

Choose a reason for hiding this comment

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

Thank you!

@jonathanrocher jonathanrocher merged commit b8ce46f into master Jul 11, 2022
@jonathanrocher jonathanrocher deleted the fix/key_error_crash branch July 11, 2022 10:53
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

Successfully merging this pull request may close these issues.

2 participants