Skip to content

some problem with object contract #696

@WenYangHong

Description

@WenYangHong
  • Version:
  • Python: 3.5
  • OS: win

What was wrong?

from web3 import Web3, HTTPProvider
web3 = Web3(HTTPProvider('http://localhost:8545'))
TheContract = web3.eth.contract(address="0x1d948e45df3337133870a238cb29a497eb7e50b6")
print(TheContract.call().transfer(web3.eth.accounts[1],100000))

This is my code , I want use this object method but It always send this to me:

Traceback (most recent call last):
  File "send_token.py", line 17, in <module>
    print(TheContract.call().transfer(web3.eth.accounts[1],100000))
  File "C:\Users\hwy\AppData\Local\Programs\Python\Python35\lib\site-packages\web3\contract.py", line 834, in call_contract_function
    transaction=transaction,
  File "C:\Users\hwy\AppData\Local\Programs\Python\Python35\lib\site-packages\web3\utils\decorators.py", line 17, in _wrapper
    return self.method(obj, *args, **kwargs)
  File "C:\Users\hwy\AppData\Local\Programs\Python\Python35\lib\site-packages\web3\contract.py", line 695, in _prepare_transaction
    fn_kwargs,
  File "C:\Users\hwy\AppData\Local\Programs\Python\Python35\lib\site-packages\eth_utils\string.py", line 108, in inner
    return force_obj_to_text(fn(*args, **kwargs))
  File "C:\Users\hwy\AppData\Local\Programs\Python\Python35\lib\site-packages\web3\contract.py", line 734, in _encode_transaction_data
    fn_name, args, kwargs,
  File "C:\Users\hwy\AppData\Local\Programs\Python\Python35\lib\site-packages\web3\contract.py", line 663, in _get_function_info
    fn_abi = cls._find_matching_fn_abi(fn_name, args, kwargs)
  File "C:\Users\hwy\AppData\Local\Programs\Python\Python35\lib\site-packages\web3\contract.py", line 616, in _find_matching_fn_abi
    function_candidates = filter_by_type('function', cls.abi)
  File "C:\Users\hwy\AppData\Local\Programs\Python\Python35\lib\site-packages\web3\utils\abi.py", line 43, in filter_by_type
    return [abi for abi in contract_abi if abi['type'] == _type]
TypeError: 'NoneType' object is not iterable

Fill this section in if you know how this could or should be fixed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions