10gic / btc-address-dump

A utility for dump BTC address from mnemonic words or private key or public key, Bitcoin forks are also supported.
MIT License
58 stars 26 forks source link

Why do I get an error when importing the module to python? #1

Closed AlftheElf closed 3 years ago

AlftheElf commented 3 years ago

import btc_address_dump File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/btc_address_dump/__init__.py", line 4, in <module> from .btc_address_dump import main_entry File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/btc_address_dump/btc_address_dump.py", line 10, in <module> import mnemonic_util File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/btc_address_dump/mnemonic_util.py", line 15, in <module> import common_util File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/btc_address_dump/common_util.py", line 55, in <module> def pubkey_from_bytes_to_point(pubkey: bytes) -> tuple[int, int]: TypeError: 'type' object is not subscriptable

What's going on here? The module should work with python3.8.5, yes?

10gic commented 3 years ago

The “TypeError: ‘type’ object is not subscriptable” error is raised when you try to access an object using indexing whose data type is “type”. To solve this error, ensure you only try to access iterable objects, like tuples and strings, using indexing.

Currently, I only have tested it as command line tool. How to reproduce this issue?

AlftheElf commented 3 years ago

All I did was import btc_address_dump and I got the error.

10gic commented 3 years ago

The root cause is Python3.8 don't supporting Generic Alias Type (https://docs.python.org/3/library/stdtypes.html#types-genericalias).

I have make it compatible with Python3.8, just upgrade it by pip3 install -U btc-address-dump