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

KeyError: '9' #22

Open
justingrayston opened this issue Aug 5, 2020 · 7 comments
Open

KeyError: '9' #22

justingrayston opened this issue Aug 5, 2020 · 7 comments

Comments

@justingrayston
Copy link
Collaborator

Error found in main.py

Traceback (most recent call last):
  File "/srv/main.py", line 753, in cluster_analysis
    result = do_cluster_analysis(image,
  File "/srv/main.py", line 186, in do_cluster_analysis
    merge(job_dict, merge_dict, cartouche_list)
  File "/srv/main.py", line 455, in merge
    job_dict['clusters_processed'].pop(inner)
KeyError: '9'
@roybgardner
Copy link

roybgardner commented Aug 6, 2020

@justingrayston Interesting. Does key '9' appear more than once in pop_list? A key can only get into pop_list if it exists in job_dict['clusters_processed'] (assuming the code works), so a duplicate may explain this error.

@justingrayston
Copy link
Collaborator Author

Doesn't it just mean that inner, which in this case is '9' isn't in job_dict['clusters_processed']. There is no Key to pop. There are a few other examples with other number values. Feels like perhaps some iteration log expecting 9 to be there, but it never was or that it already has been popped. I guess that's what your getting at, two 9s in the list that creates inner and this would happen.

I'll take a look through the logic.. Errors are few and far between atm.

@roybgardner
Copy link

roybgardner commented Aug 6, 2020

Perhaps it's cartouche-related: because cartouches are generated pre-merge, a cluster could be both inside a cartouche frame, and also inside another cluster within the cartouche frame.

justingrayston added a commit that referenced this issue Aug 8, 2020
Catching the exception removes the 500 but doesn't necassarily
close issue #22 as the cause is not replicable yet from a
glyph image.
@justingrayston
Copy link
Collaborator Author

PR #23 will catch the key error, but I am not convinced this should be happening in the first place. I've done the simple "fix" for now to stop 500 errors, but I'd like to be able to reproduce with an actual glyph image test, and so far I haven't managed to get it to do it.

@roybgardner
Copy link

The attached will test the cartouche hypothesis.

cartouche_test_2
cartouche_test

@justingrayston
Copy link
Collaborator Author

Thanks - I've been taking a bit of time off - just getting back into the swing of things. Will test this week.

@roybgardner
Copy link

Meant to say that I tested with these images but couldn't replicate the issue.

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

2 participants