Calibre-Remarkable-Device-Driver-Plugin
Calibre-Remarkable-Device-Driver-Plugin copied to clipboard
Fixed import issue
Fixed issue where the plugin was trying to import from a zip file. Now imports from a temporary unzipped folder generated by base class DevicePlugin
This should fix #17 and #14
I'm running into the following:
Plugin updated: Remarkable Plugin (1, 2, 3)
calibre 6.4 embedded-python: True
Windows-10-10.0.19044-SP0 Windows ('64bit', 'WindowsPE')
('Windows', '10', '10.0.19044')
Python 3.10.1
Windows: ('10', '10.0.19044', 'SP0', 'Multiprocessor Free')
Interface language: None
Successfully initialized third party plugins: Remarkable Plugin (1, 2, 3)
QPA platform: windows
devicePixelRatio: 1.0
logicalDpi: 96.0 x 96.0
physicalDpi: 81.55183946488295 x 81.64285714285714
ApplicationPaletteChange event ignored
Using calibre Qt style: True
[0.00] Starting up...
[0.00] Showing splash screen...
[0.17] splash screen shown
[0.17] Initializing db...
[0.24] db initialized
[0.24] Constructing main UI...
Startup method for device RemarkablePlugin threw exception
Traceback (most recent call last):
File "calibre\gui2\device.py", line 403, in run_startup
File "calibre_plugins.remarkable_plugin.__init__", line 34, in startup
IndexError: list index out of range
Error during device detection for <calibre_plugins.remarkable_plugin.RemarkablePlugin object at 0x0000021F8071F9A0>:
Traceback (most recent call last):
File "calibre\gui2\device.py", line 318, in detect_device
File "calibre_plugins.remarkable_plugin.__init__", line 57, in detect_managed_devices
AttributeError: 'RemarkablePlugin' object has no attribute 'seen_device'
[0.94] main UI initialized...
[0.94] Hiding splash screen
Starting QuickView
[1.45] splash screen hidden
[1.45] Started up in 1.45 seconds with 571 books
Error during device detection for <calibre_plugins.remarkable_plugin.RemarkablePlugin object at 0x0000021F8071F9A0>:
Traceback (most recent call last):
File "calibre\gui2\device.py", line 318, in detect_device
File "calibre_plugins.remarkable_plugin.__init__", line 57, in detect_managed_devices
AttributeError: 'RemarkablePlugin' object has no attribute 'seen_device'
Error during device detection for <calibre_plugins.remarkable_plugin.RemarkablePlugin object at 0x0000021F8071F9A0>:
Traceback (most recent call last):
File "calibre\gui2\device.py", line 318, in detect_device
File "calibre_plugins.remarkable_plugin.__init__", line 57, in detect_managed_devices
AttributeError: 'RemarkablePlugin' object has no attribute 'seen_device'
It looks like this line is having issues:
temp_unzip_path = [i for i in sys.path if i.endswith("unzip")][0]
Specifically, the array comes back as zero length and then the zero-index throws an error.
@Kenivia - what is endswith("unzip")
looking for here? A temp dir generated by remarkable-fs
and added to the sys path? Could we create a temp dir ourselves using https://docs.python.org/3/library/tempfile.html instead?
Its supposed to be generated by calibre base class plugin with the with self:
line, I’m not too sure why it didn’t work for you. I’ll check the pull request later because It is still working on my end.
Can you try printing sys.path right after with self:
? Maybe theres a slash on the end of the path?
Plugin updated: Remarkable Plugin (1, 2, 3)
calibre 6.4 embedded-python: True
Windows-10-10.0.19044-SP0 Windows ('64bit', 'WindowsPE')
('Windows', '10', '10.0.19044')
Python 3.10.1
Windows: ('10', '10.0.19044', 'SP0', 'Multiprocessor Free')
Interface language: None
Successfully initialized third party plugins: Remarkable Plugin (1, 2, 3)
QPA platform: windows
devicePixelRatio: 1.0
logicalDpi: 96.0 x 96.0
physicalDpi: 81.55183946488295 x 81.64285714285714
ApplicationPaletteChange event ignored
Using calibre Qt style: True
[0.00] Starting up...
[0.00] Showing splash screen...
[0.24] splash screen shown
[0.24] Initializing db...
[0.36] db initialized
[0.36] Constructing main UI...
----------------
['C:\\Users\\dnelson\\AppData\\Roaming\\calibre\\plugins\\Remarkable Plugin.zip', 'C:\\Users\\dnelson\\AppData\\Roaming\\calibre\\plugins\\Remarkable Plugin.zip']
----------------
Startup method for device RemarkablePlugin threw exception
Traceback (most recent call last):
File "calibre\gui2\device.py", line 403, in run_startup
File "calibre_plugins.remarkable_plugin.__init__", line 37, in startup
IndexError: list index out of range
Error during device detection for <calibre_plugins.remarkable_plugin.RemarkablePlugin object at 0x000001E899A9F9D0>:
Traceback (most recent call last):
File "calibre\gui2\device.py", line 318, in detect_device
File "calibre_plugins.remarkable_plugin.__init__", line 60, in detect_managed_devices
AttributeError: 'RemarkablePlugin' object has no attribute 'seen_device'
[1.25] main UI initialized...
So, print(sys.path)
outputs ['C:\\Users\\dnelson\\AppData\\Roaming\\calibre\\plugins\\Remarkable Plugin.zip', 'C:\\Users\\dnelson\\AppData\\Roaming\\calibre\\plugins\\Remarkable Plugin.zip']
for me here.
@DakotaNelson Hey, how did you run the .sh script on Windows? I think the issue is the __enter__
function defined here: https://github.com/kovidgoyal/calibre/blob/master/src/calibre/customize/init.py#:~:text=def%20__enter__(self%2C%20*,append(self.sys_insertion_path) , but I'm struggling to run the script to test it. It should work on Linux now though.
I'm running it via WSL - so, nominally an Ubuntu environment. The 3.10 check caught that I was using 3.8.10 - getting 3.10 on Ubuntu requires using ppa:deadsnakes/ppa
rather than the core Ubuntu repos don't provide 3.10 as far as I'm aware.
Once that's all set up and a new zip file is created, we run into the same exciting ASN1 problem again:
calibre-customize.exe -b ./ && calibre-debug.exe -g
Plugin updated: Remarkable Plugin (1, 2, 3)
calibre 6.4 embedded-python: True
Windows-10-10.0.19044-SP0 Windows ('64bit', 'WindowsPE')
('Windows', '10', '10.0.19044')
Python 3.10.1
Windows: ('10', '10.0.19044', 'SP0', 'Multiprocessor Free')
Interface language: None
Successfully initialized third party plugins: Remarkable Plugin (1, 2, 3)
QPA platform: windows
devicePixelRatio: 1.0
logicalDpi: 96.0 x 96.0
physicalDpi: 81.55183946488295 x 81.64285714285714
ApplicationPaletteChange event ignored
Using calibre Qt style: True
[0.00] Starting up...
[0.00] Showing splash screen...
[0.22] splash screen shown
[0.22] Initializing db...
[0.36] db initialized
[0.36] Constructing main UI...
Startup method for device RemarkablePlugin threw exception
Traceback (most recent call last):
File "calibre\gui2\device.py", line 403, in run_startup
File "calibre_plugins.remarkable_plugin.__init__", line 61, in startup
File "C:\Users\dnelson\AppData\Local\Temp\calibre_toegxlaz\if18ogz9plugin_unzip\target\remarkable_fs\__init__.py", line 1, in <module>
File "C:\Users\dnelson\AppData\Local\Temp\calibre_toegxlaz\if18ogz9plugin_unzip\target\remarkable_fs\connection.py", line 5, in <module>
File "C:\Users\dnelson\AppData\Local\Temp\calibre_toegxlaz\if18ogz9plugin_unzip\target\paramiko\__init__.py", line 22, in <module>
File "C:\Users\dnelson\AppData\Local\Temp\calibre_toegxlaz\if18ogz9plugin_unzip\target\paramiko\transport.py", line 91, in <module>
File "C:\Users\dnelson\AppData\Local\Temp\calibre_toegxlaz\if18ogz9plugin_unzip\target\paramiko\dsskey.py", line 25, in <module>
File "C:\Users\dnelson\AppData\Local\Temp\calibre_toegxlaz\if18ogz9plugin_unzip\target\cryptography\hazmat\primitives\serialization\__init__.py", line 16, in <module>
File "C:\Users\dnelson\AppData\Local\Temp\calibre_toegxlaz\if18ogz9plugin_unzip\target\cryptography\hazmat\primitives\serialization\base.py", line 9, in <module>
File "C:\Users\dnelson\AppData\Local\Temp\calibre_toegxlaz\if18ogz9plugin_unzip\target\cryptography\hazmat\primitives\asymmetric\types.py", line 7, in <module>
File "C:\Users\dnelson\AppData\Local\Temp\calibre_toegxlaz\if18ogz9plugin_unzip\target\cryptography\hazmat\primitives\asymmetric\dsa.py", line 10, in <module>
File "C:\Users\dnelson\AppData\Local\Temp\calibre_toegxlaz\if18ogz9plugin_unzip\target\cryptography\hazmat\primitives\asymmetric\utils.py", line 6, in <module>
ImportError: cannot import name 'asn1' from 'cryptography.hazmat.bindings._rust' (unknown location)
Error during device detection for <calibre_plugins.remarkable_plugin.RemarkablePlugin object at 0x000002755B4BFE50>:
Traceback (most recent call last):
File "calibre\gui2\device.py", line 318, in detect_device
File "calibre_plugins.remarkable_plugin.__init__", line 78, in detect_managed_devices
AttributeError: 'RemarkablePlugin' object has no attribute 'seen_device'
[2.12] main UI initialized...
[2.12] Hiding splash screen
This issue is discussed in #14 - so it looks like we might be back to where things started?
Printing sys.path
as before outputs ['C:\\Users\\dnelson\\AppData\\Roaming\\calibre\\plugins\\Remarkable Plugin.zip', 'C:\\Users\\dnelson\\AppData\\Local\\Temp\\calibre_p2sv3h_7\\yarevrrnplugin_unzip']
so that's definitely progress!
@DakotaNelson I see that you're using calibre-customize.exe -b ./
to install the plugin. This command zips the whole folder - so that the source libraries are in the target
folder instead of being in the same folder as the init.py file(I thought I added the target folder to sys.path). Can you please try installing the plugin using the zip file generated by the shell script? Thanks. Also, the Python 3.10 is required because the embedded Python version in calibre is 3.10, there isn't really a way around it but Ubuntu 22.04 does come with Python 3.10 by default.
Ran the zip script fresh to make sure I had the newest, then installed the plugin zip using Calibre's interface:
$ calibre-debug.exe -g
calibre 6.4 embedded-python: True
Windows-10-10.0.19044-SP0 Windows ('64bit', 'WindowsPE')
('Windows', '10', '10.0.19044')
Python 3.10.1
Windows: ('10', '10.0.19044', 'SP0', 'Multiprocessor Free')
Interface language: None
QPA platform: windows
devicePixelRatio: 1.0
logicalDpi: 96.0 x 96.0
physicalDpi: 81.55183946488295 x 81.64285714285714
ApplicationPaletteChange event ignored
Using calibre Qt style: True
[0.00] Starting up...
[0.00] Showing splash screen...
[0.17] splash screen shown
[0.17] Initializing db...
[0.23] db initialized
[0.23] Constructing main UI...
[0.92] main UI initialized...
[0.92] Hiding splash screen
Starting QuickView
[1.36] splash screen hidden
[1.36] Started up in 1.36 seconds with 571 books
stdout+stderr from file dialog helper: [b'', b'']
piped data from file dialog helper: [b"^\xd1'\xcf\xa4\x12\x1c\xcb\xa5#N~\xc02n.\xba\xd6\xb38\xff\xb9\x
de\xe6\xaa{\x11\x8b\xb0)P\x12", b'C:\\Users\\[snip]\\Downloads\\calibre-remarkable-device-driver-plugin.zip']
Then restarted Calibre to pick up the newly installed plugin:
$ calibre-debug.exe -g
calibre 6.4 embedded-python: True
Windows-10-10.0.19044-SP0 Windows ('64bit', 'WindowsPE')
('Windows', '10', '10.0.19044')
Python 3.10.1
Windows: ('10', '10.0.19044', 'SP0', 'Multiprocessor Free')
Interface language: None
Successfully initialized third party plugins: Remarkable Plugin (1, 2, 3)
QPA platform: windows
devicePixelRatio: 1.0
logicalDpi: 96.0 x 96.0
physicalDpi: 81.55183946488295 x 81.64285714285714
ApplicationPaletteChange event ignored
Using calibre Qt style: True
[0.00] Starting up...
[0.02] Showing splash screen...
[0.19] splash screen shown
[0.19] Initializing db...
[0.25] db initialized
[0.25] Constructing main UI...
----------------
['C:\\Users\\dnelson\\AppData\\Roaming\\calibre\\plugins\\Remarkable Plugin.zip', 'C:\\Users\\dnelson\
\AppData\\Local\\Temp\\calibre__jugp4dc\\u1ymbpv6plugin_unzip']
----------------
Startup method for device RemarkablePlugin threw exception
Traceback (most recent call last):
File "calibre\gui2\device.py", line 403, in run_startup
File "calibre_plugins.remarkable_plugin.__init__", line 64, in startup
File "C:\Users\dnelson\AppData\Roaming\calibre\plugins\Remarkable Plugin.zip\remarkable_fs\__init__.
py", line 1, in <module>
File "C:\Users\dnelson\AppData\Roaming\calibre\plugins\Remarkable Plugin.zip\remarkable_fs\connectio
n.py", line 5, in <module>
File "C:\Users\dnelson\AppData\Roaming\calibre\plugins\Remarkable Plugin.zip\paramiko\__init__.py",
line 22, in <module>
File "C:\Users\dnelson\AppData\Roaming\calibre\plugins\Remarkable Plugin.zip\paramiko\transport.py",
line 91, in <module>
File "C:\Users\dnelson\AppData\Roaming\calibre\plugins\Remarkable Plugin.zip\paramiko\dsskey.py", li
ne 25, in <module>
File "C:\Users\dnelson\AppData\Roaming\calibre\plugins\Remarkable Plugin.zip\cryptography\hazmat\pri
mitives\serialization\__init__.py", line 16, in <module>
File "C:\Users\dnelson\AppData\Roaming\calibre\plugins\Remarkable Plugin.zip\cryptography\hazmat\pri
mitives\serialization\base.py", line 9, in <module>
File "C:\Users\dnelson\AppData\Roaming\calibre\plugins\Remarkable Plugin.zip\cryptography\hazmat\pri
mitives\asymmetric\types.py", line 7, in <module>
File "C:\Users\dnelson\AppData\Roaming\calibre\plugins\Remarkable Plugin.zip\cryptography\hazmat\pri
mitives\asymmetric\dsa.py", line 10, in <module>
File "C:\Users\dnelson\AppData\Roaming\calibre\plugins\Remarkable Plugin.zip\cryptography\hazmat\pri
mitives\asymmetric\utils.py", line 6, in <module>
ImportError: cannot import name 'asn1' from 'cryptography.hazmat.bindings._rust' (unknown location)
Error during device detection for <calibre_plugins.remarkable_plugin.RemarkablePlugin object at 0x0000
0222BD84BE20>:
Traceback (most recent call last):
File "calibre\gui2\device.py", line 318, in detect_device
File "calibre_plugins.remarkable_plugin.__init__", line 81, in detect_managed_devices
AttributeError: 'RemarkablePlugin' object has no attribute 'seen_device'
[1.67] main UI initialized...
[1.67] Hiding splash screen
Starting QuickView
[2.08] splash screen hidden
[2.08] Started up in 2.08 seconds with 571 books
Error during device detection for <calibre_plugins.remarkable_plugin.RemarkablePlugin object at 0x0000
0222BD84BE20>:
Traceback (most recent call last):
File "calibre\gui2\device.py", line 318, in detect_device
File "calibre_plugins.remarkable_plugin.__init__", line 81, in detect_managed_devices
AttributeError: 'RemarkablePlugin' object has no attribute 'seen_device'
Error during device detection for <calibre_plugins.remarkable_plugin.RemarkablePlugin object at 0x0000
0222BD84BE20>:
Traceback (most recent call last):
File "calibre\gui2\device.py", line 318, in detect_device
File "calibre_plugins.remarkable_plugin.__init__", line 81, in detect_managed_devices
AttributeError: 'RemarkablePlugin' object has no attribute 'seen_device'
I can reproduce on Ubuntu 22.10.
installed calibre binary from their website and immediately installed this plugin by installing a .zip generated from create-plugin-zip.sh
at tip of master version.
Installation is fine, config works as expected, but doesn't seem to work, and I have the same error message. I'm not sure where to go from here to debug further...