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

ImportError: cannot import name 'Mapping' from 'collections' (C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\collections\__init__.py) #114

Open
fastikprog opened this issue Mar 11, 2024 · 0 comments

Comments

@fastikprog
Copy link

from tronapi import Tron
import logging

import json

logging.basicConfig(level=logging.DEBUG, format="%(asctime)s - %(levelname)s - %(message)s")
logger = logging.getLogger()

full_node = 'https://api.trongrid.io'
solidity_node = 'https://api.trongrid.io'
event_server = 'https://api.trongrid.io'

tron = Tron(full_node=full_node,
        solidity_node=solidity_node,
        event_server=event_server)

account = tron.create_account
is_valid = bool(tron.trx.is_address(account.address.hex))

logger.debug('Generated account: ')
logger.debug('- Private Key: ' + account.private_key)
logger.debug('- Public Key: ' + account.public_key)
logger.debug('- Address: ')
logger.debug('-- Base58: ' + account.address.base58)
logger.debug('-- Hex: ' + account.address.hex)
logger.debug('-- isValid: ' + str(is_valid))
logger.debug('-----------')

transaction = tron.trx.get_transaction('757a14cef293c69b1cf9b9d3d19c2e40a330c640b05c6ffa4d54609a9628758c')

logger.debug('Transaction: ')
logger.debug('- Hash: ' + transaction['txID'])
logger.debug('- Transaction: ' + json.dumps(transaction, indent=2))
logger.debug('-----------')

# Events
event_result = tron.trx.get_event_result('TGEJj8eus46QMHPgWQe1FJ2ymBXRm96fn1', 0, 'Notify')

logger.debug('Event result:')
logger.debug('Contract Address: TGEJj8eus46QMHPgWQe1FJ2ymBXRm96fn1')
logger.debug('Event Name: Notify')
logger.debug('Block Number: 32162')
logger.debug('- Events: ' + json.dumps(event_result, indent=2))

Traceback (most recent call last):
File "C:\Users\User\Desktop\Projects\Exchane bot\t.py", line 1, in
from tronapi import Tron
File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\site-packages\tronapi_init_.py", line 11, in
from eth_account import Account # noqa: E402
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\site-packages\eth_account_init_.py", line 1, in
from eth_account.account import ( # noqa: F401
File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\site-packages\eth_account\account.py", line 1, in
from collections import (
ImportError: cannot import name 'Mapping' from 'collections' (C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\collections_init_.py)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant