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

IndexError: list index out of range #54

Closed
dawidwelna opened this issue Jun 27, 2021 · 6 comments
Closed

IndexError: list index out of range #54

dawidwelna opened this issue Jun 27, 2021 · 6 comments

Comments

@dawidwelna
Copy link

Hi! I am trying to use the tool for the first time, all issues which I had I was able to solve with the help of previous closed issues but..
I am running kindle2notion on mac os and now I run into an issue, which I haven't found so I opened a new one.
here is a short traceback

Notion page is found. Analyzing clippings file...
Found 652 notes and highlights.

Traceback (most recent call last):
  File "/opt/anaconda3/bin/kindle2notion", line 8, in <module>
    sys.exit(main())
  File "/opt/anaconda3/lib/python3.8/site-packages/click/core.py", line 1134, in __call__
    return self.main(*args, **kwargs)
  File "/opt/anaconda3/lib/python3.8/site-packages/click/core.py", line 1059, in main
    rv = self.invoke(ctx)
  File "/opt/anaconda3/lib/python3.8/site-packages/click/core.py", line 1401, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/anaconda3/lib/python3.8/site-packages/click/core.py", line 767, in invoke
    return __callback(*args, **kwargs)
  File "/opt/anaconda3/lib/python3.8/site-packages/kindle2notion/__main__.py", line 25, in main
    books = parse_raw_clippings_text(all_clippings)
  File "/opt/anaconda3/lib/python3.8/site-packages/kindle2notion/parsing.py", line 18, in parse_raw_clippings_text
    author, title = _parse_author_and_title(raw_clipping_list)
  File "/opt/anaconda3/lib/python3.8/site-packages/kindle2notion/parsing.py", line 35, in _parse_author_and_title
    author, title = _parse_raw_author_and_title(raw_clipping_list)
  File "/opt/anaconda3/lib/python3.8/site-packages/kindle2notion/parsing.py", line 68, in _parse_raw_author_and_title
    author = (re.findall(r'\(.*?\)', raw_clipping_list[0]))[-1]
IndexError: list index out of range

Does anybody know how to solve this issue?

@paperboi
Copy link
Owner

Hi, chances are you have a book that has no author listed in it's metadata. Will write a fix for this and include it in the next release.

@dawidwelna
Copy link
Author

dawidwelna commented Jun 28, 2021

yes I have a few books that have no author. I have many articles etc..
But I managed to solve it by setting up the repo myself and installing the dependencies with conda and then installing the package inside my conda environment

python setup.py install

I'm also planning now to try to make this package to work with my language polish etc. Because during copying the characters like "ę", "ą", "ł" are lost
maybe you already know how to solve it?

@paperboi
Copy link
Owner

yes I have a few books that have no author. I have many articles etc..
But I managed to solve it by setting up the repo myself and installing the dependencies with conda and then installing the package inside my conda environment

python setup.py install

I'm also planning now to try to make this package to work with my language polish etc. Because during copying the characters like "ę", "ą", "ł" are lost
maybe you already know how to solve it?

I know it's an issue with the way the file is read in kindle2notion/reading.py but haven't been successful so far in getting it right. Please do look into it if you can and update here what you find. Thanks for taking the initiative!

@paperboi
Copy link
Owner

yes I have a few books that have no author. I have many articles etc..
But I managed to solve it by setting up the repo myself and installing the dependencies with conda and then installing the package inside my conda environment

python setup.py install

I'm also planning now to try to make this package to work with my language polish etc. Because during copying the characters like "ę", "ą", "ł" are lost
maybe you already know how to solve it?

Hi @dawidwelna, if it's okay, can you please forward me a clipping of one such article which has no author listed from your My Clippings file? I had written a function to account for this case earlier and wanted to know how this would have gone past that.

@dawidwelna
Copy link
Author

@paperboi here is a draft PR #55
I fixed the issue with missing polish characters. I still need to add unit tests, so please wait for it. I've been busy recently.
Also there is an example file you asked which you may use. I am not sure if this is a correct excerpt that generated an error, but definitely there is a book without an author inside.

@paperboi
Copy link
Owner

@dawidwelna, just got the fix for this up- please update to the latest version (1.0.0) and try again. The setup is a little different too so please go through the README file and docs.

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