web3.py: deploy contract example is broken ! "Expected an int, bytes, bytearray or hexstr."

Your own example has stopped working?

versions: web3 4.2.0, solc 0.4.23+commit.124ca40d.Linux.gpp, eth_tester 0.1.0b24, python 3.5.3 (default, Jan 19 2017, 14:11:04) [GCC 6.3.0 20170118]

~/py3/site-packages/eth_tester/backends/__init__.py:48: UserWarning: Ethereum Tester: No backend was explicitely set, and no *full* backends were available.  Falling back to the `MockBackend` which does not support all EVM functionality.  Please refer to the `eth-tester` documentation for information on what backends are available and how to set them.
  "Ethereum Tester: No backend was explicitely set, and no *full* "
~/DeployContractExample.py:20: DeprecationWarning: deploy is deprecated in favor of contract.constructor.transact
  bytecode=contract_interface['bin']).deploy()

Traceback (most recent call last):
  File "~/DeployContractExample.py", line 41, in <module>
    address = deploy_contract(w3, contract_interface)
  File "~/DeployContractExample.py", line 20, in deploy_contract
    bytecode=contract_interface['bin']).deploy()
  File "~/py3/site-packages/web3/utils/decorators.py", line 57, in wrapper
    return to_wrap(*args, **kwargs)
  File "~/py3/site-packages/web3/contract.py", line 289, in deploy
    deploy_transaction['data'] = cls._encode_constructor_data(args, kwargs)
  File "~/py3/site-packages/web3/utils/decorators.py", line 16, in _wrapper
    return self.method(objtype, *args, **kwargs)
  File "~/py3/site-packages/web3/contract.py", line 667, in _encode_constructor_data
    arguments = merge_args_and_kwargs(constructor_abi, args, kwargs)
  File "~/py3/site-packages/web3/utils/abi.py", line 204, in merge_args_and_kwargs
    len(args) + len(kwargs),

TypeError: Incorrect argument count.  Expected '1'.  Got '0'

What was wrong?

Please see

How can it be fixed?

Repair example code.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15

Most upvoted comments

glad to hear it!

yes, me too. Thanks for your bugfix!