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: unsupported operand type(s) for +: 'NoneType' and 'str' #55

Closed
leononame opened this issue Jun 26, 2023 · 3 comments
Closed
Labels
bug Something isn't working

Comments

@leononame
Copy link

Bug description

I get a bug when trying to show loaned books from the plugin:

calibre, version 5.43.0
ERROR: Unhandled exception: <b>TypeError</b>:unsupported operand type(s) for +: 'NoneType' and 'str'

calibre 5.43  embedded-python: False is64bit: True
Linux-6.3.8-200.fc38.x86_64-x86_64-with-glibc2.37 Linux ('64bit', 'ELF')
('Linux', '6.3.8-200.fc38.x86_64', '#1 SMP PREEMPT_DYNAMIC Thu Jun 15 02:15:40 UTC 2023')
Python 3.11.3
Interface language: None
Successfully initialized third party plugins: DeACSM (0, 0, 16) && DeDRM (7, 2, 1)
Traceback (most recent call last):
  File "calibre_plugins.deacsm.config", line 1298, in show_rented_books
    d = RentedBooksDialog(self, self.deacsmprefs["list_of_rented_books"])
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "calibre_plugins.deacsm.config", line 1321, in __init__
    self.populate_list()
  File "calibre_plugins.deacsm.config", line 1398, in populate_list
    item = QListWidgetItem(book["book_name"] + " " + info)
                           ~~~~~~~~~~~~~~~~~~^~~~~
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

Is this maybe due to me having deleted a book and it still being somehow in the database?

Operating system

Linux

Which version of Calibre are you running?

5.43.0

Which version of the ACSM Input plugin are you running?

v0.0.16

Import type

No response

Further information

No response

@Leseratte10
Copy link
Owner

Yes, this can sometimes happen in 0.0.16 due to a bug. It's already fixed by a9519fb. There hasn't been a new release yet since the data migration from 0.0.16 to 0.1.0 sometimes fails and I haven't been able to figure out why that happens yet.

If you make a backup of your plugin data / authorization data you can try updating to the new version ( https://github.com/Leseratte10/acsm-calibre-plugin/suites/13032316339/artifacts/706161437 ), then the bug should be gone.

@Leseratte10 Leseratte10 added the bug Something isn't working label Jun 26, 2023
@leononame
Copy link
Author

Glad it's fixed. I tried updating using the migration plugin, however my ADE account link didn't survive the migration. Trying to add the account again, I get a different error:

calibre, version 5.43.0
ERROR: Unhandled exception: <b>OSError</b>:error:0308010C:digital envelope routines::unsupported

calibre 5.43  embedded-python: False is64bit: True
Linux-6.3.8-200.fc38.x86_64-x86_64-with-glibc2.37 Linux ('64bit', 'ELF')
('Linux', '6.3.8-200.fc38.x86_64', '#1 SMP PREEMPT_DYNAMIC Thu Jun 15 02:15:40 UTC 2023')
Python 3.11.3
Interface language: None
Successfully initialized third party plugins: ACSM Input (0, 1, 0) && DeDRM (7, 2, 1) && ACSM Input Plugin GUI Extension (0, 1, 0)
Traceback (most recent call last):
  File "calibre_plugins.deacsm.config", line 1217, in link_account
    success, resp = activateDevice(vers_idx, None)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/leo/.config/calibre/plugins/ACSM Input.zip/libadobeAccount.py", line 830, in activateDevice
    signature = sign_node(req_xml)
                ^^^^^^^^^^^^^^^^^^
  File "/home/leo/.config/calibre/plugins/ACSM Input.zip/libadobe.py", line 536, in sign_node
    my_priv_key, _, _ = keys.parse_pkcs12(my_pkcs12, base64.b64encode(devkey_bytes))
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/leo/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/_openssl/asymmetric.py", line 774, in parse_pkcs12
    return _parse_pkcs12(data, password, load_private_key)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/leo/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/_asymmetric.py", line 866, in _parse_pkcs12
    decrypted_content = _decrypt_encrypted_data(encryption_algorithm_info, encrypted_content, password)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/leo/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/_asymmetric.py", line 1036, in _decrypt_encrypted_data
    plaintext = decrypt_func(enc_key, encrypted_content, enc_iv)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/leo/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/_openssl/symmetric.py", line 364, in rc2_cbc_pkcs5_decrypt
    return _decrypt('rc2', key, data, iv, True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/leo/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/_openssl/symmetric.py", line 750, in _decrypt
    handle_openssl_error(res)
  File "/home/leo/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/_openssl/_libcrypto.py", line 86, in handle_openssl_error
    raise exception_class(_try_decode(error_string))
OSError: error:0308010C:digital envelope routines::unsupported

I'll stay with the older version for now.

@Leseratte10
Copy link
Owner

Yeah; that's one of the reasons the new plugin isn't released yet. I'm going to close this issue since the bug itself is fixed and the fix will be included in the next release. If this happens multiple times and gets too annoying you can take the 0.0.16 version that you have, unpack the ZIP and just add this change here: a9519fb

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