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

"tuple index out of range" #4

Closed
lutefiasco opened this issue Jan 11, 2021 · 9 comments
Closed

"tuple index out of range" #4

lutefiasco opened this issue Jan 11, 2021 · 9 comments
Labels
bug Something isn't working

Comments

@lutefiasco
Copy link

I'm sure this is on me, but I mis-entered my Zotero UserID and API key initially. On re-running Zowie with the -a argument and a newly created API key, and then the correct Zotero UserID, I'm getting a "Encountered error IndexError: tuple index out of range." and then Zowie exits. I tried running it with the debug option, but the process fails in the same place.

@lutefiasco
Copy link
Author

lutefiasco commented Jan 11, 2021

I'm sure this is on me,

I managed to get the debug output, though the error still occurs.
relevant bits:

saving credentials to keyring
keyring_utils.py:71 save_keyring_credentials() -- storing "DELETED" to keyring mhucka.zowie
zotero.py:91 init() -- connecting to Zotero as user DELETED
main_body.py:78 run() -- exception in main body: tuple index out of range
main_body.py:80 run() -- finished MainBody
main.py:272 main() -- main body raised exception: (<class 'IndexError'>, IndexError('tuple index out of range'), <traceback object at 0x10af63908>)
cli.py:99 _print_or_queue() -- Encountered error IndexError: tuple index out of range
Encountered error IndexError: tuple index out of range
main.py:288 main() -- Exception: tuple index out of range
Traceback (most recent call last):
File "/Users/DELETED/.pyenv/versions/3.7.3/lib/python3.7/site-packages/zowie/main_body.py", line 75, in run
self._do_preflight()
File "/Users/DELETED/.pyenv/versions/3.7.3/lib/python3.7/site-packages/zowie/main_body.py", line 130, in _do_preflight
if len(self.files) > 1 or path.isdir(self.files[0]):
IndexError: tuple index out of range

@mhucka
Copy link
Owner

mhucka commented Jan 12, 2021

Thanks for the report! I see the reason for the error (it's a bug -- it's not testing for a empty self.files before trying to index into it), but from the discussion on the DEVONthink forums, it sounds like the location you are trying to use is empty, which will still be a problem even after this bug is fixed. Can you tell me more about your Zotero setup? Specifically, where do the PDF files for your library live? See the Preferences, under Advanced, "Files and Folders", like the screenshot here – it would help me to know the data directory location in your setup:

image

@mhucka mhucka added the bug Something isn't working label Jan 12, 2021
@lutefiasco
Copy link
Author

lutefiasco commented Jan 12, 2021

Well, it's good to know it isn't just me.

All the PDFs for my Zotero library are synced across all my devices by Box.com (provided by UCLA, where I'm faculty), which appears and functions as a regular folder in the MacOS Finder. (If anything, it avoids some of the annoying issues with iCloud requiring under-used files redownload). So, my Zotero library is in the default location, but every PDF is a "linked" attachment, and distributed across perhaps a dozen subfolders below ~/Box Sync/. So, that's the Zotero base directory. The data directory is in the default location.
Screen Shot 2021-01-11 at 7 25 00 PM

Anyway, thanks for looking into the bug / issue. DevonThink is made even more amazing by having such an interested and interesting development community.

@mhucka
Copy link
Owner

mhucka commented Jan 12, 2021

The bug caused Zowie to not complain about a missing argument. I'm fixing that now and will produce a version 1.1.1. Once that's fixed, can you try it again with something like the following?

zowie ~/Box\ Sync

or if you only want it to act on PDF files,

zowie -f pdf ~/Box\ Sync

(note the backslash for quoting of the space in the pathname). Unfortunately I've never used this "linked attachment" scheme so I don't even know what the structure looks like inside that directory. If it's full of symbolic links, we may find out it won't work without additional changes. But let's fix this argument parsing problem first.

@mhucka
Copy link
Owner

mhucka commented Jan 12, 2021

OK, version 1.1.1 is out there, if you want to give it a try. (Whenever – no rush.)

@lutefiasco
Copy link
Author

lutefiasco commented Jan 12, 2021

Screen Shot 2021-01-12 at 7 50 59 AM

Well, the upgrade worked. The folder is just full of real PDFs, not symbolic links, but clearly the relationship between the PDFs and the Zotero database works differently. It's possibly my use-case is fairly rare. Thanks for the fix, though.

@mhucka
Copy link
Owner

mhucka commented Jan 12, 2021

Shoot, that's too bad. The way Zowie figures out the record associated with a given PDF file is that in the other Zotero storage option, the files are in subdirectories keyed by a unique identifier, like ..../Z743PE2/some filename.pdf. Thanks to that, it's possible to ask the Zotero API about Z743PE2. Without that, I don't know how to infer the record associated with a given file.

@mhucka
Copy link
Owner

mhucka commented Jan 12, 2021

I'll ask on the Zotero forums. Maybe there's a way to do it.

In the meantime, I'm going to close this issue, as it appears the original reason (the error that arose when no argument was given) has been resolved.

Update: the Zotero forum question is at https://forums.zotero.org/discussion/comment/372519/#Comment_372519

@mhucka
Copy link
Owner

mhucka commented Jan 13, 2021

Fixed in release 1.1.1.

@mhucka mhucka closed this as completed Jan 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants