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

Opaque error when data sources is missing a column #46

Open
jakebeal opened this issue Oct 14, 2021 · 3 comments · May be fixed by #236
Open

Opaque error when data sources is missing a column #46

jakebeal opened this issue Oct 14, 2021 · 3 comments · May be fixed by #236
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@jakebeal
Copy link
Contributor

When the "data sources" tab is missing a column (e.g., column G on old versions of the sheet), it exceptions with an opaque error:

>>> doc = es.excel_to_sbol(wb)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python39\site-packages\sbol_utilities\excel_to_sbol.py", line 426, in excel_to_sbol
    basic_parts, composite_parts, linear_products, final_products, source_table = read_metadata(wb, doc, config)
  File "C:\Python39\site-packages\sbol_utilities\excel_to_sbol.py", line 110, in read_metadata
    source_table = {row[config['source_name_col']].value: row[config['source_uri_col']].value
  File "C:\Python39\site-packages\sbol_utilities\excel_to_sbol.py", line 112, in <dictcomp>
    if row[config['source_literal_col']].value}
IndexError: tuple index out of range

It should at least be more graceful about its crash.

@jakebeal jakebeal added the bug Something isn't working label Oct 14, 2021
@jakebeal
Copy link
Contributor Author

There is a similar issue when there are extra columns not expected, thus causing a problem in interpretation.

@jakebeal jakebeal added this to the 1.0a13 milestone Oct 28, 2021
@jakebeal jakebeal added the good first issue Good for newcomers label Jan 17, 2022
@jakebeal jakebeal removed this from the 1.0a14 milestone Jan 18, 2022
@mohitdmak
Copy link
Collaborator

Hello @jakebeal , enclosing the part of reading_metadata where it fetches the G column (Literal part) in a try block seems to handle this, shouldn't this be all that's needed? Also, can you describe the issue of parsing with extra columns? I am not able to reproduce it by editing the simple library xl file.

@jakebeal
Copy link
Contributor Author

@mohitdmak I'm not surprised if it's a fairly simple fix.

For the extra columns, example, try inserting some columns in the middle with new names. I don't think it's being smart enough to handle it. If it is, though, then add a test case to validate and we're good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants