nicolasshu / zotero2papis

5 stars 1 forks source link

object is not subscriptable #2

Open johannes-titz opened 1 year ago

johannes-titz commented 1 year ago

I am getting the following error:

Traceback (most recent call last):
  File "/home/jt/.local/bin/zotero2papis", line 8, in <module>
    sys.exit(run())
  File "/usr/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/jt/.local/lib/python3.10/site-packages/zotero2papis/zotero2papis.py", line 549, in run
    client.run()
  File "/home/jt/.local/lib/python3.10/site-packages/zotero2papis/zotero2papis.py", line 513, in run
    files, target_dir, deleted_entry = self.getFiles(conn, itemID, itemKey)
  File "/home/jt/.local/lib/python3.10/site-packages/zotero2papis/zotero2papis.py", line 380, in getFiles
    if path[:8] != "storage:": continue
TypeError: 'NoneType' object is not subscriptable

I do not have much experience with python so I did not look into the code. Running up to date arch. Any ideas what could be causing this?

nicolasshu commented 1 year ago

That's weird. This is essentially saying that you have a Zotero entry that supposedly has an attachment that is not a PDF stored in your system, but that attachment also doesn't exist? Like Schrodinger's cat?

Can you run it with the -v or --verbose flag to see which item is it and whether it is a file for an entry that, idk, has been removed? Also, could you also check to see if that's an entry that has been removed from your Zotero? The reason I ask is b/c the way Zotero handles their database is a bit messy, and one of the things they don't do is: when you delete an entry from Zotero using the Zotero application (GUI), it doesn't delete it from the SQL database. So if you originally had 30 entries, and then one day decided that you didn't want 23 of them laying around, those entries will forever be in the SQL database, and it turns into a huge mess.

remisphere commented 3 weeks ago

I encounter the same error, maybe not for the same reason. My Zotero library usually contains both the PDF file and a link to the online version ; zotero2papis seems to dislike that, deleting the link (from the bin also) removes the error for that one entry. I have no knowledge of the internal of zotero2papis, but I'd guess it is misled by the name of the link, that also has the .pdf extension ?

In Python 3.11:

===================================
  TITLE: the title
AUTHORS: the authors
===================================
    KEY   A39PFUWR
    PATH  None
    PARID 333
Traceback (most recent call last):
  File "/path/to/zotero2papis", line 8, in <module>
    sys.exit(run())
             ^^^^^
  File "/path/to/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/path/to/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/site-packages/zotero2papis/zotero2papis.py", line 549, in run
    client.run()
  File "/path/to/site-packages/zotero2papis/zotero2papis.py", line 513, in run
    files, target_dir, deleted_entry = self.getFiles(conn, itemID, itemKey)
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/site-packages/zotero2papis/zotero2papis.py", line 281, in getFiles
    if path[:8] == "storage:":
       ~~~~^^^^
TypeError: 'NoneType' object is not subscriptable