title: Web3.py “Unknown account” error when trying to write SmartContract to Pancakeswap router
body: <p>I started developing a small program which should allow me to buy tokens via pancakeswap router. When I try to do transaction, I get &quot;unknow account&quot; error. I think it might be because I should be locally 'logged' to my metamask account, but it's only my assumption. I exported my private key and tried to make an account from it using <code>w3.eth.account.from_key(privateKey)</code> but it didn't do anything. I also tried to do <code>w3.toChecksumAddress(address)</code> on all addresses but it didn't do anything. I have no idea what can I do at this point.</p>
  <hr>
  This is my code:
  <pre><code>binanceRPC = 'https://bsc-dataseed1.defibit.io/'
  w3 = Web3(Web3.HTTPProvider(binanceRPC))
  
  
  PCS_V2_ADDR = w3.toChecksumAddress(
      '0x10ED43C718714eb63d5aA57B78B54704E256024E')
  PCS_ABI = #there would be pcs ABI but i needed to delete it due to character limit on stack
  PCS_ROUTER_CONTRACT = w3.eth.contract(address=PCS_V2_ADDR, abi=PCS_ABI)
  
  print(w3.isConnected())  # True
  
  WBNB = w3.toChecksumAddress('0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c')
  shitcoin = w3.toChecksumAddress('0x3ee2200efb3400fabb9aacf31297cbdd1d435d47')
  
  nonce = w3.eth.get_transaction_count(testAccAddr)
  
  amountIn = 0.0005
  
  tx = {
      'nonce': nonce,
      'from': testAccAddr,
      'to': PCS_V2_ADDR,
      'gasPrice': 5,
      'gas': 165250,
      'value': w3.toWei(amountIn, 'ether')
  }
  
  w3.eth.account.privateKeyToAccount(testAccPrvKey)
  print(w3.eth.accounts)  # []
  
  txHash = PCS_ROUTER_CONTRACT.functions.swapExactETHForTokens(0, [w3.toChecksumAddress('0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c'), w3.toChecksumAddress(
      '0x3ee2200efb3400fabb9aacf31297cbdd1d435d47')], testAccAddr, 1621289953).transact(tx)  # ValueError: {'code': -32000, 'message': 'unknown account'}
  </code></pre>