spesmilo / electrum

Electrum Bitcoin Wallet

Home Page:https://electrum.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ValueError: Can't parse 'name[:]length' token '_pos'.

TARS-bot opened this issue · comments

commented

Crash Report

This crash report was reported through the automatic crash reporting system 🤖

Traceback

Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/bitstring/bitarray_.py", line 126, in __setattr__
    super().__setattr__(attribute, value)
AttributeError: 'BitArray' object has no attribute '_pos'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/electrum/gui/qt/request_list.py", line 114, in item_changed
    self.receive_tab.update_current_request()
  File "/usr/lib/python3.11/site-packages/electrum/gui/qt/receive_tab.py", line 255, in update_current_request
    self.lnaddr = self.wallet.get_bolt11_invoice(req) if not help_texts.ln_is_error else ''
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/electrum/wallet.py", line 2767, in get_bolt11_invoice
    lnaddr, invoice = self.lnworker.get_bolt11_invoice(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/electrum/lnworker.py", line 2187, in get_bolt11_invoice
    invoice = lnencode(lnaddr, self.node_keypair.privkey)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/electrum/lnaddr.py", line 188, in lnencode
    data += tagged_bytes('p', addr.paymenthash)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/electrum/lnaddr.py", line 142, in tagged_bytes
    return tagged(char, bitstring.BitArray(l))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/electrum/lnaddr.py", line 136, in tagged
    return bitstring.pack("uint:5, uint:5, uint:5",
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/bitstring/bitstream.py", line 189, in __add__
    s._pos = 0
    ^^^^^^
  File "/usr/lib/python3.11/site-packages/bitstring/bitarray_.py", line 128, in __setattr__
    dtype = bitstring.dtypes.Dtype(attribute)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/bitstring/dtypes.py", line 63, in __new__
    x = cls._new_from_token(token, scale)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/bitstring/dtypes.py", line 142, in _new_from_token
    return dtype_register.get_dtype(*utils.parse_name_length_token(token), scale=scale)
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/bitstring/utils.py", line 94, in parse_name_length_token
    raise ValueError(f"Can't parse 'name[:]length' token '{fmt}'.")
ValueError: Can't parse 'name[:]length' token '_pos'.

ValueError: Can't parse 'name[:]length' token '_pos'.

Reporter

This issue was reported by 10 user(s):

Electrum Version Python Version Operating System Wallet Type Locale Stack
4.5.4 3.11.9 (main, Apr 6 2024, 16:32:42) [GCC 13.2.1 20240210] Linux-6.8.7-gentoo-dist-x86_64-Intel-R-_Core-TM-i7-7700K_CPU@_4.20GHz-with-glibc2.39 standard en_GB ℹ
4.5.4 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] Linux-5.15.0-105-generic-x86_64-with-glibc2.35 standard pt_BR ℹ
4.5.4 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] Linux-5.15.0-91-generic-x86_64-with-glibc2.35 standard en_US ℹ
4.5.4 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] Linux-5.15.0-102-generic-x86_64-with-glibc2.35 standard en_US ℹ
4.5.4 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] Linux-5.15.0-102-generic-x86_64-with-glibc2.35 standard en_US ℹ
4.5.4 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] Linux-6.5.0-28-generic-x86_64-with-glibc2.35 standard en_US ℹ
4.5.4 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] Linux-6.5.0-28-generic-x86_64-with-glibc2.35 standard en_US ℹ
4.5.4 3.12.3 (main, Apr 10 2024, 05:33:47) [GCC 13.2.0] Linux-6.8.0-31-generic-x86_64-with-glibc2.39 standard en_US ℹ
4.5.4 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] Linux-6.1.0-21-amd64-x86_64-with-glibc2.36 standard en_US ℹ
4.5.4 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] Linux-6.5.0-35-generic-x86_64-with-glibc2.35 standard en_US ℹ

Additional Information

The reporting user(s) did not provide additional information.

Reported by me. Error happens every time I click on a created Receive address.

This is because you recently upgraded bitstring; the latest version is incompatibe with Electrum.
To fix this, we have removed bitstring from our dependencies, see #9020
If you want to keep using Electrum with your current python environment, you would need to use the git repo.
Otherwise, you can also use our latest Appimage.

I see, makes sense, Gentoo life :> Maybe new release soon Electrum 4.5.5 ?

Alternatively you can just downgrade bitstring for now.

The fix from master (#9020) is now backported to the 4.5.x branch as c9ed717.