Calibre-Remarkable-Device-Driver-Plugin icon indicating copy to clipboard operation
Calibre-Remarkable-Device-Driver-Plugin copied to clipboard

Error message on startup

Open hkdd opened this issue 3 years ago • 13 comments

I confirmed SSH was working (ip and password are correct) by connecting from my computer, which is also running calibre. No device button appeared, so I started calibre-debug -g and received the following error. This is just repeated over and over until I kill calibre.

Also, every time you save the config settings it adds another "/" to the end of the paths (books and config). If you just press "customize" and ok then open again, you'll see another "/" at the end of both paths.

  File "/home/user/.config/calibre/plugins/Remarkable Plugin.zip/remarkable_fs/documents.py", line 291, in load_node_without_linking
    node = cls(self, id, metadata)
  File "/home/user/.config/calibre/plugins/Remarkable Plugin.zip/remarkable_fs/documents.py", line 364, in __init__
    self._size = self.root.sftp.stat(self.id + "." + self.file_type()).st_size
  File "/usr/lib/python3.9/site-packages/paramiko/sftp_client.py", line 493, in stat
    t, msg = self._request(CMD_STAT, path)
  File "/usr/lib/python3.9/site-packages/paramiko/sftp_client.py", line 813, in _request
    return self._read_response(num)
  File "/usr/lib/python3.9/site-packages/paramiko/sftp_client.py", line 865, in _read_response
    self._convert_status(msg)
  File "/usr/lib/python3.9/site-packages/paramiko/sftp_client.py", line 894, in _convert_status
    raise IOError(errno.ENOENT, text)
FileNotFoundError: [Errno 2] No such file

hkdd avatar Oct 01 '21 12:10 hkdd

Yes currently an extra / gets appended, although I believe this should be harmless.

I'm not able to fully understand why the above error is happening. Could you re-run Calibre in debug mode and copy the initialization of the plugin? Meaning, the first time this error occurs, and the lines above it showing the plugin initialization.

Could you also tell me what OS you are using?

naclander avatar Oct 02 '21 06:10 naclander

Sure, OS is Linux (Fedora 34):

calibre 4.23  embedded-python: False is64bit: True                                                                                                                     
Linux-5.13.19-200.fc34.x86_64-x86_64-with-glibc2.33 Linux ('64bit', 'ELF')                                                                                             
('Linux', '5.13.19-200.fc34.x86_64', '#1 SMP Sat Sep 18 16:32:24 UTC 2021')                                                                                            
Python 3.9.7                                                                                                                                                           
Interface language: None                                                                                                                                               
Successfully initialized third party plugins: Gather KFX-ZIP (from KFX Input) (1, 26, 0) && Package KFX (from KFX Input) (1, 26, 0) && KFX metadata reader (from KFX In
put) (1, 26, 0) && KFX Input (1, 26, 0) && Remarkable Plugin (1, 1, 0)                                                                                                 
Turning on automatic hidpi scaling                                                                                                                                     
devicePixelRatio: 1.0                                                                                                                                                  
logicalDpi: 96.0 x 96.0                                                                                                                                                
physicalDpi: 110.83636363636363 x 110.73569482288829                                                                                                                   
Using calibre Qt style: True                                                                                                                                           
[0.00] Starting up...                                                                                                                                                  
[0.00] Showing splash screen...                                                                                                                                        
[0.02] splash screen shown                                                                                                                                             
[0.02] Initializing db...                                                                                                                                              
[0.03] db initialized                                                                                                                                                  
[0.03] Constructing main UI...                                                                                                                                         
Loaded cached store plugin for: Библио.бг at version: 2                                                                                                                
Loaded cached store plugin for: Project Gutenberg at version: 8                                                                                                        
Loaded cached store plugin for: Kobo at version: 8                                                                                                                     
Trying to connect to 10.200.16.163                                                                                                                                     
PING 10.200.16.163 (10.200.16.163) 56(84) bytes of data.                                                                                                               
64 bytes from 10.200.16.163: icmp_seq=1 ttl=64 time=4.68 ms                                                                                                            
                                                                                                                                                                       
--- 10.200.16.163 ping statistics ---                                                                                                                                  
1 packets transmitted, 1 received, 0% packet loss, time 0ms                                                                                                            
rtt min/avg/max/mdev = 4.680/4.680/4.680/0.000 ms                                                                                                                      
Devcie 10.200.16.163 Present                                                                                                                                           
Opening device                                                                                                                                                         
Reading document information |                                | 1/41Traceback (most recent call last):                                                                 
  File "/home/user/.config/calibre/plugins/Remarkable Plugin.zip/remarkable_fs/documents.py", line 291, in load_node_without_linking                                    
    node = cls(self, id, metadata)                                                                                                                                     
  File "/home/user/.config/calibre/plugins/Remarkable Plugin.zip/remarkable_fs/documents.py", line 364, in __init__                                                     
    self._size = self.root.sftp.stat(self.id + "." + self.file_type()).st_size                                                                                         
  File "/usr/lib/python3.9/site-packages/paramiko/sftp_client.py", line 493, in stat                                                                                   
    t, msg = self._request(CMD_STAT, path)                                                                                                                             
  File "/usr/lib/python3.9/site-packages/paramiko/sftp_client.py", line 813, in _request                                                                               
    return self._read_response(num)                                                                                                                                    
  File "/usr/lib/python3.9/site-packages/paramiko/sftp_client.py", line 865, in _read_response                                                                         
    self._convert_status(msg)                                                                                                                                          
  File "/usr/lib/python3.9/site-packages/paramiko/sftp_client.py", line 894, in _convert_status                                                                        
    raise IOError(errno.ENOENT, text)                                                                                                                                  
FileNotFoundError: [Errno 2] No such file                 

hkdd avatar Oct 02 '21 15:10 hkdd

This looks like a remarkable_fs error. I believe it is trying to build the document root here but its failing for some reason.

My basic understanding of this library is that it builds a tree from the root directory in remarkable and includes all files and folders in the tree. This tree is what the plugin uses to add/remove files from the device. I've deleted many files from my Remarkable tablet and I've never seen the tree creation process break. It is as if when building the document tree it can't find something on your device, but of course the stack trace doesn't say what that something is.

I'm going to make a new release ( 1.2.2 ) with some more logging just to make sure my suspicion is true, I would appreciate if you could grab another stack trace for me.

naclander avatar Oct 03 '21 00:10 naclander

Of course! Be happy to. Thanks for investigating.

hkdd avatar Oct 03 '21 00:10 hkdd

Hey @hkdd were you able to get another stack trace of your failure?

naclander avatar Oct 12 '21 04:10 naclander

Hi and I hope I am allowed to jump in ...

Running on linux mint

  • Calibre 5.31.1
  • your plugin downloaded and compiled today (sorry for beeing stupid but I can not see / find the version)

Here is the error:

$ calibre-debug -g
calibre 5.31.1  embedded-python: True is64bit: True
Linux-5.11.0-38-generic-x86_64-with-glibc2.2.5 Linux ('64bit', 'ELF')
('Linux', '5.11.0-38-generic', '#42~20.04.1-Ubuntu SMP Tue Sep 28 20:41:07 UTC 2021')
Python 3.8.5
Interface language: de
Successfully initialized third party plugins: Remarkable Plugin (1, 2, 3)
Turning on automatic hidpi scaling
devicePixelRatio: 1.0
logicalDpi: 120.0 x 120.0
physicalDpi: 91.86652314316468 x 93.3061224489796
Using calibre Qt style: True
[0.00] Starting up...
[0.00] Showing splash screen...
[0.06] splash screen shown
[0.06] Initializing db...
[0.15] db initialized
[0.15] Constructing main UI...
Startup method for device RemarkablePlugin threw exception
Traceback (most recent call last):
  File "calibre/gui2/device.py", line 376, in run_startup
  File "calibre_plugins.remarkable_plugin.__init__", line 33, in startup
    import remarkable_fs
  File "zipimport.py", line 259, in load_module
  File "/home/thomas/.config/calibre/plugins/Remarkable Plugin.zip/remarkable_fs/__init__.py", line 1, in <module>
    from remarkable_fs.connection import connect
  File "zipimport.py", line 259, in load_module
  File "/home/thomas/.config/calibre/plugins/Remarkable Plugin.zip/remarkable_fs/connection.py", line 5, in <module>
    from paramiko.client import SSHClient, AutoAddPolicy
  File "zipimport.py", line 259, in load_module
  File "/home/thomas/.config/calibre/plugins/Remarkable Plugin.zip/paramiko/__init__.py", line 22, in <module>
    from paramiko.transport import SecurityOptions, Transport
  File "zipimport.py", line 259, in load_module
  File "/home/thomas/.config/calibre/plugins/Remarkable Plugin.zip/paramiko/transport.py", line 89, in <module>
    from paramiko.dsskey import DSSKey
  File "zipimport.py", line 259, in load_module
  File "/home/thomas/.config/calibre/plugins/Remarkable Plugin.zip/paramiko/dsskey.py", line 25, in <module>
    from cryptography.hazmat.primitives import hashes, serialization
  File "zipimport.py", line 259, in load_module
  File "/home/thomas/.config/calibre/plugins/Remarkable Plugin.zip/cryptography/hazmat/primitives/serialization/__init__.py", line 15, in <module>
    from cryptography.hazmat.primitives.serialization.base import (
  File "zipimport.py", line 259, in load_module
  File "/home/thomas/.config/calibre/plugins/Remarkable Plugin.zip/cryptography/hazmat/primitives/serialization/base.py", line 11, in <module>
    from cryptography.hazmat.primitives.asymmetric.types import (
  File "zipimport.py", line 259, in load_module
  File "/home/thomas/.config/calibre/plugins/Remarkable Plugin.zip/cryptography/hazmat/primitives/asymmetric/types.py", line 7, in <module>
    from cryptography.hazmat.primitives.asymmetric import (
  File "zipimport.py", line 259, in load_module
  File "/home/thomas/.config/calibre/plugins/Remarkable Plugin.zip/cryptography/hazmat/primitives/asymmetric/dsa.py", line 12, in <module>
    from cryptography.hazmat.primitives.asymmetric import (
  File "zipimport.py", line 259, in load_module
  File "/home/thomas/.config/calibre/plugins/Remarkable Plugin.zip/cryptography/hazmat/primitives/asymmetric/utils.py", line 6, in <module>
    from cryptography.hazmat.bindings._rust import asn1
ImportError: cannot import name 'asn1' from 'cryptography.hazmat.bindings._rust' (unknown location)
Error during device detection for <calibre_plugins.remarkable_plugin.RemarkablePlugin object at 0x7f4ce377f8e0>:
Traceback (most recent call last):
  File "calibre/gui2/device.py", line 291, in detect_device
  File "calibre_plugins.remarkable_plugin.__init__", line 50, in detect_managed_devices
    if self.seen_device:
AttributeError: 'RemarkablePlugin' object has no attribute 'seen_device'

tak-21 avatar Nov 03 '21 17:11 tak-21

@tak-21 please open a new issue

ImportError: cannot import name 'asn1' from 'cryptography.hazmat.bindings._rust' (unknown location)

This is different than what everyone else's issue is on this thread. But is related to the overall problem of the remarkable_fs dependency relying on c bindings, and I don't know how to make my remarkable plugin portable with these dependencies.

naclander avatar Nov 11 '21 18:11 naclander

Dear Naclander, thank for your plugin. I have the same problem of @tak-21 with my remarkable 2 (log below). It would be great to have the possibility to use calibre with remarkable, any clue about how or who can solve that?

Startup method for device RemarkablePlugin threw exception Error during device detection for <calibre_plugins.remarkable_plugin.RemarkablePlugin object at 0x10852afa0>: [1.15] main UI initialized... [1.15] Hiding splash screen Starting QuickView Traceback (most recent call last): File "calibre/gui2/device.py", line 376, in run_startup File "calibre_plugins.remarkable_plugin.init", line 33, in startup import remarkable_fs File "zipimport.py", line 259, in load_module File "/Users/clamac/Library/Preferences/calibre/plugins/Remarkable Plugin.zip/remarkable_fs/init.py", line 1, in from remarkable_fs.connection import connect File "zipimport.py", line 259, in load_module File "/Users/clamac/Library/Preferences/calibre/plugins/Remarkable Plugin.zip/remarkable_fs/connection.py", line 5, in from paramiko.client import SSHClient, AutoAddPolicy File "zipimport.py", line 259, in load_module File "/Users/clamac/Library/Preferences/calibre/plugins/Remarkable Plugin.zip/paramiko/init.py", line 22, in from paramiko.transport import SecurityOptions, Transport File "zipimport.py", line 259, in load_module File "/Users/clamac/Library/Preferences/calibre/plugins/Remarkable Plugin.zip/paramiko/transport.py", line 89, in from paramiko.dsskey import DSSKey File "zipimport.py", line 259, in load_module File "/Users/clamac/Library/Preferences/calibre/plugins/Remarkable Plugin.zip/paramiko/dsskey.py", line 25, in from cryptography.hazmat.primitives import hashes, serialization File "zipimport.py", line 259, in load_module File "/Users/clamac/Library/Preferences/calibre/plugins/Remarkable Plugin.zip/cryptography/hazmat/primitives/serialization/init.py", line 15, in from cryptography.hazmat.primitives.serialization.base import ( File "zipimport.py", line 259, in load_module File "/Users/clamac/Library/Preferences/calibre/plugins/Remarkable Plugin.zip/cryptography/hazmat/primitives/serialization/base.py", line 11, in from cryptography.hazmat.primitives.asymmetric.types import ( File "zipimport.py", line 259, in load_module File "/Users/clamac/Library/Preferences/calibre/plugins/Remarkable Plugin.zip/cryptography/hazmat/primitives/asymmetric/types.py", line 7, in from cryptography.hazmat.primitives.asymmetric import ( File "zipimport.py", line 259, in load_module File "/Users/clamac/Library/Preferences/calibre/plugins/Remarkable Plugin.zip/cryptography/hazmat/primitives/asymmetric/dsa.py", line 12, in from cryptography.hazmat.primitives.asymmetric import ( File "zipimport.py", line 259, in load_module File "/Users/clamac/Library/Preferences/calibre/plugins/Remarkable Plugin.zip/cryptography/hazmat/primitives/asymmetric/utils.py", line 6, in from cryptography.hazmat.bindings._rust import asn1 ImportError: cannot import name 'asn1' from 'cryptography.hazmat.bindings._rust' (unknown location) Traceback (most recent call last):

clacole avatar Dec 06 '21 19:12 clacole

I'm getting an error at startup as well. Versions:

  • Plugin version is 1.2.3
  • Windows 10
  • Calibre 5.33.2

Plugin configuration: image (obviously, it's having the "extra slash" problem)

Log file with the error: reMarkable_plugin_error.txt

robfreundlich avatar Dec 14 '21 21:12 robfreundlich

Hello,

This looks like a remarkable_fs error. I believe it is trying to build the document root here but its failing for some reason.

My basic understanding of this library is that it builds a tree from the root directory in remarkable and includes all files and folders in the tree. This tree is what the plugin uses to add/remove files from the device. I've deleted many files from my Remarkable tablet and I've never seen the tree creation process break. It is as if when building the document tree it can't find something on your device, but of course the stack trace doesn't say what that something is.

I'm going to make a new release ( 1.2.2 ) with some more logging just to make sure my suspicion is true, I would appreciate if you could grab another stack trace for me.

I did some debugging, and this error occurs on file with type "notebook", remarkable_fs tries to read a file named {id}.notebook which does not exists.

Those files wont be added to the tree, but the others (PDF, ePUBs) should be. I think those errors can be safely ignored.

There is another error, which is a bit more annoying:

Finished creating document root
Error while trying to open True (Driver: <calibre_plugins.remarkable_plugin.RemarkablePlugin object at 0x7f5de4c9b370>)
Traceback (most recent call last):
  File "/usr/lib/calibre/calibre/gui2/device.py", line 333, in detect_device
    dev.open(cd, self.current_library_uuid)
  File "calibre_plugins.remarkable_plugin.__init__", line 96, in open
    self.device_total_space = 1024 * int(stdout.read())
ValueError: invalid literal for int() with base 10: b''

That one seems to prevent the device from being available in Calibre, I will see if this is a Python version related issue and will try to make a PR on this.

xals avatar May 25 '22 13:05 xals

Hello,

This looks like a remarkable_fs error. I believe it is trying to build the document root here but its failing for some reason. My basic understanding of this library is that it builds a tree from the root directory in remarkable and includes all files and folders in the tree. This tree is what the plugin uses to add/remove files from the device. I've deleted many files from my Remarkable tablet and I've never seen the tree creation process break. It is as if when building the document tree it can't find something on your device, but of course the stack trace doesn't say what that something is. I'm going to make a new release ( 1.2.2 ) with some more logging just to make sure my suspicion is true, I would appreciate if you could grab another stack trace for me.

I did some debugging, and this error occurs on file with type "notebook", remarkable_fs tries to read a file named {id}.notebook which does not exists.

Those files wont be added to the tree, but the others (PDF, ePUBs) should be. I think those errors can be safely ignored.

There is another error, which is a bit more annoying:

Finished creating document root
Error while trying to open True (Driver: <calibre_plugins.remarkable_plugin.RemarkablePlugin object at 0x7f5de4c9b370>)
Traceback (most recent call last):
  File "/usr/lib/calibre/calibre/gui2/device.py", line 333, in detect_device
    dev.open(cd, self.current_library_uuid)
  File "calibre_plugins.remarkable_plugin.__init__", line 96, in open
    self.device_total_space = 1024 * int(stdout.read())
ValueError: invalid literal for int() with base 10: b''

That one seems to prevent the device from being available in Calibre, I will see if this is a Python version related issue and will try to make a PR on this.

For more information, I am trying to connect to a remarkable2 device, and here are the debug display at the start of the process:

calibre 5.42  embedded-python: False is64bit: True
Linux-5.17.8-artix1-1-x86_64-with-glibc2.35 Linux ('64bit', 'ELF')
('Linux', '5.17.8-artix1-1', '#1 SMP PREEMPT Tue, 17 May 2022 00:27:44 +0000')
Python 3.10.4
Interface language: fr
Successfully initialized third party plugins: KOReader Sync (0, 2, 7) && Remarkable Plugin (1, 2, 3)
Not controlling automatic hidpi scaling
devicePixelRatio: 1.0
logicalDpi: 96.04726735598227 x 96.0
physicalDpi: 108.91792294807368 x 108.85714285714285
Using calibre Qt style: True
[0.00] Starting up...
[0.01] Showing splash screen...
[0.03] splash screen shown
[0.03] Initializing db...
[0.03] db initialized
[0.03] Constructing main UI...
DEBUG:    0.0 koreader:action:could not start pydevd_pycharm, e = No module named 'pydevd_pycharm'
DEBUG:    0.2 koreader:action:KoreaderAction:genesis:start

xals avatar May 25 '22 13:05 xals

Here is the PR: #16

xals avatar May 25 '22 13:05 xals

By the way, the traces mentioned here are related to https://github.com/nick8325/remarkable-fs. There is the issue nick8325/remarkable-fs#6 about this problem, opened in 2018.

xals avatar May 25 '22 13:05 xals