Skip to content

Error when generating duplicate report #9

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

Open
step21 opened this issue Oct 27, 2022 · 4 comments
Open

Error when generating duplicate report #9

step21 opened this issue Oct 27, 2022 · 4 comments

Comments

@step21
Copy link

step21 commented Oct 27, 2022

Did you ever encounter this error? This when running on the main library, because that's where I need it.
Could it be because for testing I am using a read-only key? However the "report" options shouldn't write anything, right?

File "/home/appuser/venv/lib/python3.7/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 562, in _run_script
    exec(code, module.__dict__)
File "/app/zoterotidy/app.py", line 456, in <module>
    utils.update_duplicate_attach_state()
File "/app/zoterotidy/utils.py", line 816, in update_duplicate_attach_state
    st.session_state.zot, st.session_state.zot_items
File "/app/zoterotidy/utils.py", line 229, in get_items_with_duplicate_pdf
    _pdf_attachments[key].append(c["data"]["filename"])
@chraibi
Copy link
Owner

chraibi commented Oct 27, 2022

Hi,
I think your library is fine (read or write does not matter).
As you said, these are read-only operations. The bug is in ZoteroTidy.

The problem is some item in your library was detected as not standalone, so it is supposed to have a filename, but it does not.

Here is the line of code that raises the exception

    _pdf_attachments[key].append(c["data"]["filename"])

KeyError: 'filename'

I just updated the app with some debug messages, because I would like to know more about the item, that causes this bug.

Could you try again?

I did not fix it yet! Thank you for helping out with the debugging.

@step21
Copy link
Author

step21 commented Feb 11, 2023

Hey,
sorry for taking so long to get back to this. I was at the end of my dissertation and I am still not done with my backlog of emails etc :)

I just tried it again and this is the result - this is with library set to own, and otherwise more or less the same library.

File "/home/appuser/venv/lib/python3.7/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 565, in _run_script
    exec(code, module.__dict__)
File "/app/zoterotidy/app.py", line 197, in <module>
    st.session_state.num_items = st.session_state.zot.count_items()
File "/home/appuser/venv/lib/python3.7/site-packages/pyzotero/zotero.py", line 551, in count_items
    return self._totals(query)
File "/home/appuser/venv/lib/python3.7/site-packages/pyzotero/zotero.py", line 564, in _totals
    self._retrieve_data(query)
File "/home/appuser/venv/lib/python3.7/site-packages/pyzotero/zotero.py", line 413, in _retrieve_data
    error_handler(self, self.request)
File "/home/appuser/venv/lib/python3.7/site-packages/pyzotero/zotero.py", line 1642, in error_handler
    raise error_codes.get(req.status_code)(err_msg(req))

@step21
Copy link
Author

step21 commented Jun 9, 2023

Do you need anything else that could be helpful to debug this?

@chraibi
Copy link
Owner

chraibi commented Jun 10, 2023

Hi @step21,
Apologies for the delay in my response. Regarding the current issue, it seems there is a new error that has arisen. Previously, there was a bug in the update_duplicate_attach_state() function, but it has been addressed. I have added some debug messages to provide additional information in case you encounter the issue again. These messages should help me understand why the item you mentioned, which is expected to be standalone, lacks an attachment.

However, this one is a bit trickier, then it's an error generated by the pyzotero library, explicitly this function.

The error you showed is triggered by this line.
ze.HTTPError(err_msg(req)) is raised for miscellaneous URLLib errors (according to the doc of pyzotero).
Typically this error indicates that an exception has occurred during a network operation using the URLLib library in Python.

Maybe there might be something wrong with the information in your config.cfg?

Probably unrelated, but what do you mean your library is set to own? Is library_type==group?

Best, would be you try it again, and I can take a look at the logs,
or you send me a minimal zotero library that causes this problem, so that I can debug it on my computer.

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