karask / python-bitcoin-utils

Library to interact with the Bitcoin network. Ideal for low-level learning and experimenting.
MIT License
262 stars 99 forks source link

TypeError: 'type' object is not subscriptable #62

Closed mhshoara closed 4 months ago

mhshoara commented 4 months ago

I tried to run this code : https://github.com/karask/python-bitcoin-utils/blob/master/examples/spend_p2tr_default_path.py I got tihs TypeError : Traceback (most recent call last): File "bitcoin.py", line 14, in from bitcoinutils.transactions import Transaction, TxInput, TxOutput, TxWitnessInput File "/home/mhshoara/.local/lib/python3.8/site-packages/bitcoinutils/transactions.py", line 35, in from bitcoinutils.script import Script File "/home/mhshoara/.local/lib/python3.8/site-packages/bitcoinutils/script.py", line 233, in class Script: File "/home/mhshoara/.local/lib/python3.8/site-packages/bitcoinutils/script.py", line 272, in Script def init(self, script: list[Any]): TypeError: 'type' object is not subscriptable

How can I solve this problem ?

karask commented 4 months ago

Hi @mhshoara,

You need python 3.10 and above for the typing to work. I updated the readme accordingly. Thanks for the feedback.