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

TypeError: 'NoneType' object is not subscriptable #2

Closed
datthinh1801 opened this issue Apr 20, 2021 · 9 comments
Closed

TypeError: 'NoneType' object is not subscriptable #2

datthinh1801 opened this issue Apr 20, 2021 · 9 comments

Comments

@datthinh1801
Copy link

Recently I've found your plugin and it is brilliant.
However, when I perform WordDumb on some books, I get a TypeError: 'NoneType' object is not subscriptable.
Details (copy from calibre):

calibre, version 5.16.0
ERROR: Unhandled exception: <b>TypeError</b>:'NoneType' object is not subscriptable

calibre 5.16 [64bit]  embedded-python: True is64bit: True
Windows-10-10.0.19041 Windows ('64bit', 'WindowsPE')
('Windows', '10', '10.0.19041')
Python 3.8.5
Windows: ('10', '10.0.19041', '', 'Multiprocessor Free')
Interface language: None
Successfully initialized third party plugins: Find Duplicates (1, 8, 5) && WordDumb (3, 6, 3)
Traceback (most recent call last):
  File "calibre\gui2\__init__.py", line 499, in dispatch
  File "calibre_plugins.worddumb.main", line 71, in done
  File "calibre_plugins.worddumb.send_file", line 69, in send
  File "calibre_plugins.worddumb.send_file", line 36, in send_files
TypeError: 'NoneType' object is not subscriptable

Anyway, thanks for your help and brilliant work!

@xxyzz
Copy link
Owner

xxyzz commented Apr 20, 2021

I should check the value returned from calibre api is not None. Looks like your Kindle is ejected?

WordDumb/send_file.py

Lines 34 to 36 in bd1c395

device_info = self.device_manager.get_current_device_information()
# /Volumes/Kindle
device_path_prefix = device_info['info'][4]['main']['prefix']

https://github.com/kovidgoyal/calibre/blob/06d82ad1c3f75722906a8ced56834ec1bc584917/src/calibre/gui2/device.py#L510-L511

https://github.com/kovidgoyal/calibre/blob/06d82ad1c3f75722906a8ced56834ec1bc584917/src/calibre/gui2/device.py#L185-L187

@xxyzz
Copy link
Owner

xxyzz commented Apr 20, 2021

v3.6.4 should resolve this bug.

@datthinh1801
Copy link
Author

datthinh1801 commented Apr 20, 2021

Actually, I don't think this is the case because my device is not ejected. Right after importing the error book, I can still import other books without errors.
For more information, I am trying to import the book Sprint: How to Solve Big Problems and Test New Ideas in Just Five Days into my kindle using WordDumb but it does not work and only this book has the problem.

@xxyzz
Copy link
Owner

xxyzz commented Apr 20, 2021

What's error on v3.6.4? Please upload the book or send it to my email if you want.

@datthinh1801
Copy link
Author

datthinh1801 commented Apr 21, 2021

Here is the book.
The error still remains on v3.6.4.

@xxyzz
Copy link
Owner

xxyzz commented Apr 21, 2021

Please post the error message of v3.6.4, I can't produce the error. I think it has nothing to do with the book but rather caused by something else.

@datthinh1801
Copy link
Author

Actually, on v3.6.4, there is no error message; however, WordDumb still does not work with that book.

More specifically, on the previous version, WordDumb sometimes failed to import the book into my Kindle and raised that error message; in other times, it imported successfully but there was no WordWise of that book found in my Kindle.
On the new version, no error message emerges but WordDumb only imports the book into my Kindle, no WordWise (same as the latter case on the previous version).

FYI, I am using Kindle PaperWhite, maybe there is a problem with the device ?

@xxyzz
Copy link
Owner

xxyzz commented Apr 21, 2021

That's weird. Maybe your USB port is lose, but you said the book was sent to the device successfully. Maybe shutil.move() failed silently, but that also seems unlikely. I have no idea... My suggestion is try a different port or different machine to eliminate some possibilities.

I added shutil.copyfileobj and fsync() if shutil.move() doesn't move the file in this zip file, please try and see if it works for you.

worddumb-test.zip

@datthinh1801
Copy link
Author

Hi, the new version 3.6.6 fixed the problem perfectly 👍🏻
Thank you very much!! Completely appreciate your work!!

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