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

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

Open
TARS-bot opened this issue Apr 28, 2024 · 4 comments
Open

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

TARS-bot opened this issue Apr 28, 2024 · 4 comments

Comments

@TARS-bot
Copy link

TARS-bot commented Apr 28, 2024

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 7 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

Additional Information

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

@CocolinoFan
Copy link

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

@ecdsa
Copy link
Member

ecdsa commented Apr 28, 2024

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.

@CocolinoFan
Copy link

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

@spesmilo spesmilo deleted a comment from NadBTC Apr 29, 2024
@SomberNight
Copy link
Member

Alternatively you can just downgrade bitstring for now.

@SomberNight SomberNight added this to the 4.5.5 milestone Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants