title: Web3.py TypeError: Address <object> must be provided as a string
body: <p>I have an issue using web3.py library. I'm trying to interact with a deployed smart contract on the Polygon (layer2) network.</p>
  <p>Here is my python code:</p>
  <pre class="lang-py prettyprint-override"><code>def mintNFT(metaCID):
      polygon_url = &quot;https://rpc-mainnet.maticvigil.com&quot;
      web3 = Web3(Web3.HTTPProvider(polygon_url))
      print (&quot;BlockchainIsConnected :&quot;,web3.isConnected())
  
      my_account = &quot;MY_PRIVATE_KEY&quot;
      
      acct = web3.eth.account.from_key(my_account)
      web3.eth.defaultAccount = acct
      
      print (type(acct.address), type(acct.key)) #Returns str and str
  
      abi_file = open('/Users/aa/Desktop/minty/data/abi/Minty.json','r')
      abi = json.load(abi_file)
      minty_contract_address = web3.toChecksumAddress(&quot;CONTRACT_ADDRESS&quot;)
      contract = web3.eth.contract(address=minty_contract_address,abi=abi)
      tx_hash = contract.functions.mintToken(acct.address,metaCID).transact()
      print (&quot;tx_hash =&quot;,web3.toHex(tx_hash))
      web3.eth.waitForTransactionReceipt(tx_hash) #Waiting for transaction to be mined
  </code></pre>
  <p>I don't understand because acct.address is a string (my public address from my privatekey) 20 bytes long (without &quot;Ox&quot; as prefix).</p>
  <p>Here is my Solidity code:</p>
  <pre><code>pragma solidity ^0.7.0;
  
  import &quot;hardhat/console.sol&quot;;
  import &quot;@openzeppelin/contracts/token/ERC721/ERC721.sol&quot;;
  import &quot;@openzeppelin/contracts/utils/Counters.sol&quot;;
  
  contract Minty is ERC721 {
      using Counters for Counters.Counter;
      Counters.Counter private _tokenIds;
  
      constructor() ERC721(&quot;TOKENNAME&quot;, &quot;SYMBOL&quot;) {}
  
      function mintToken(address owner, string memory metadataURI)
      public
      returns (uint256)
      {
          _tokenIds.increment();
  
          uint256 id = _tokenIds.current();
          _safeMint(owner, id);
          _setTokenURI(id, metadataURI);
  
          return id;
      }
  }
  </code></pre>
  <p>And here is the full error:</p>
  <pre><code>Traceback (most recent call last):
    File &quot;/Users/aa/Desktop/minty/scripts/test.py&quot;, line 80, in &lt;module&gt;
      mintNFT(metaCID)
    File &quot;/Users/aa/Desktop/minty/scripts/test.py&quot;, line 76, in mintNFT
      tx_hash = contract.functions.mintToken(acct.address,metaCID).transact()
    File &quot;/usr/local/lib/python3.9/site-packages/web3/contract.py&quot;, line 997, in transact
      return transact_with_contract_function(
    File &quot;/usr/local/lib/python3.9/site-packages/web3/contract.py&quot;, line 1590, in transact_with_contract_function
      txn_hash = web3.eth.send_transaction(transact_transaction)
    File &quot;/usr/local/lib/python3.9/site-packages/web3/eth.py&quot;, line 577, in send_transaction
      return self._send_transaction(transaction)
    File &quot;/usr/local/lib/python3.9/site-packages/web3/module.py&quot;, line 53, in caller
      (method_str, params), response_formatters = method.process_params(module, *args, **kwargs)  # noqa: E501
    File &quot;/usr/local/lib/python3.9/site-packages/web3/method.py&quot;, line 201, in process_params
      _apply_request_formatters(params, self.request_formatters(method)))
    File &quot;/usr/local/lib/python3.9/site-packages/eth_utils/functional.py&quot;, line 45, in inner
      return callback(fn(*args, **kwargs))
    File &quot;/usr/local/lib/python3.9/site-packages/web3/method.py&quot;, line 51, in _apply_request_formatters
      formatted_params = pipe(params, request_formatters)
    File &quot;cytoolz/functoolz.pyx&quot;, line 667, in cytoolz.functoolz.pipe
    File &quot;cytoolz/functoolz.pyx&quot;, line 642, in cytoolz.functoolz.c_pipe
    File &quot;cytoolz/functoolz.pyx&quot;, line 505, in cytoolz.functoolz.Compose.__call__
    File &quot;cytoolz/functoolz.pyx&quot;, line 254, in cytoolz.functoolz.curry.__call__
    File &quot;cytoolz/functoolz.pyx&quot;, line 250, in cytoolz.functoolz.curry.__call__
    File &quot;/usr/local/lib/python3.9/site-packages/eth_utils/decorators.py&quot;, line 91, in wrapper
      return ReturnType(result)  # type: ignore
    File &quot;/usr/local/lib/python3.9/site-packages/eth_utils/applicators.py&quot;, line 22, in apply_formatter_at_index
      yield formatter(item)
    File &quot;cytoolz/functoolz.pyx&quot;, line 254, in cytoolz.functoolz.curry.__call__
    File &quot;cytoolz/functoolz.pyx&quot;, line 250, in cytoolz.functoolz.curry.__call__
    File &quot;/usr/local/lib/python3.9/site-packages/web3/_utils/rpc_abi.py&quot;, line 212, in apply_abi_formatters_to_dict
      formatted_values = map_abi_data(
    File &quot;cytoolz/functoolz.pyx&quot;, line 254, in cytoolz.functoolz.curry.__call__
    File &quot;cytoolz/functoolz.pyx&quot;, line 250, in cytoolz.functoolz.curry.__call__
    File &quot;/usr/local/lib/python3.9/site-packages/web3/_utils/abi.py&quot;, line 799, in map_abi_data
      return pipe(data, *pipeline)
    File &quot;cytoolz/functoolz.pyx&quot;, line 667, in cytoolz.functoolz.pipe
    File &quot;cytoolz/functoolz.pyx&quot;, line 642, in cytoolz.functoolz.c_pipe
    File &quot;cytoolz/functoolz.pyx&quot;, line 254, in cytoolz.functoolz.curry.__call__
    File &quot;cytoolz/functoolz.pyx&quot;, line 250, in cytoolz.functoolz.curry.__call__
    File &quot;/usr/local/lib/python3.9/site-packages/web3/_utils/abi.py&quot;, line 833, in data_tree_map
      return recursive_map(map_to_typed_data, data_tree)
    File &quot;/usr/local/lib/python3.9/site-packages/web3/_utils/decorators.py&quot;, line 30, in wrapped
      wrapped_val = to_wrap(*args)
    File &quot;/usr/local/lib/python3.9/site-packages/web3/_utils/formatters.py&quot;, line 89, in recursive_map
      items_mapped = map_collection(recurse, data)
    File &quot;/usr/local/lib/python3.9/site-packages/web3/_utils/formatters.py&quot;, line 76, in map_collection
      return datatype(map(func, collection))
    File &quot;/usr/local/lib/python3.9/site-packages/web3/_utils/formatters.py&quot;, line 88, in recurse
      return recursive_map(func, item)
    File &quot;/usr/local/lib/python3.9/site-packages/web3/_utils/decorators.py&quot;, line 30, in wrapped
      wrapped_val = to_wrap(*args)
    File &quot;/usr/local/lib/python3.9/site-packages/web3/_utils/formatters.py&quot;, line 90, in recursive_map
      return func(items_mapped)
    File &quot;/usr/local/lib/python3.9/site-packages/web3/_utils/abi.py&quot;, line 830, in map_to_typed_data
      return ABITypedData(func(*elements))
    File &quot;/usr/local/lib/python3.9/site-packages/web3/_utils/normalizers.py&quot;, line 78, in wrapper
      modified = to_wrap(type_str, data)
    File &quot;/usr/local/lib/python3.9/site-packages/web3/_utils/normalizers.py&quot;, line 196, in abi_address_to_hex
      validate_address(data)
    File &quot;/usr/local/lib/python3.9/site-packages/web3/_utils/validation.py&quot;, line 177, in validate_address
      raise TypeError('Address {} must be provided as a string'.format(value))
  TypeError: Address &lt;eth_account.signers.local.LocalAccount object at 0x105ddb7c0&gt; must be provided as a string
  </code></pre>
  <p>I'm using the 5.21.0 version of Web3.py.</p>
  <p>I will not provide my ABI here because it's a very long json file. But let me know if you need it.</p>
  <p>I could try to call the solidity function with a RawTransaction, but I don't know how to pass parameters inside.</p>