# Error from the data field

**URL:** <https://forum.algorand.co/t/error-from-the-data-field/1698>\
**Category:** Uncategorized\
**Tags:** contribute\
**Created:** [May 28, 2020, 6:10am UTC](https://forum.algorand.co/t/error-from-the-data-field/1698 "2020-05-28T06:10:23Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![ddev](https://avatars.discourse-cdn.com/v4/letter/d/45deac/32.png) [@ddev](https://forum.algorand.co/u/ddev)\
**Post date:** [May 28, 2020, 6:10am UTC](https://forum.algorand.co/t/error-from-the-data-field/1698/1 "2020-05-28T06:10:23Z")

</div>

I am getting arror from terminal that says : “built-in functions not subscriptable”.

1. If I’m passing in these arguments in the data field, must they all come in order or order not matter?

```auto

```

---

<div class="post-metadata">

**Author:** ![fabrice](https://avatars.discourse-cdn.com/v4/letter/f/5fc32e/32.png) [@fabrice](https://forum.algorand.co/u/fabrice)\
**Post date:** [May 28, 2020, 11:57am UTC](https://forum.algorand.co/t/error-from-the-data-field/1698/2 "2020-05-28T11:57:52Z")

</div>

1. Can you send us the code and the full error message?
2. The order does not matter in a dict such as `data`.

---

<div class="post-metadata">

**Author:** ![ddev](https://avatars.discourse-cdn.com/v4/letter/d/45deac/32.png) [@ddev](https://forum.algorand.co/u/ddev)\
**Post date:** [May 28, 2020, 1:55pm UTC](https://forum.algorand.co/t/error-from-the-data-field/1698/3 "2020-05-28T13:55:04Z")

</div>

I’ve been working around it. But here is another error I’m getting when I had to specify each parameter in the data field.

 ![15906737866836005091545758357492](https://us1.discourse-cdn.com/flex016/uploads/algorand/original/1X/242ab4421ece217b667f3d6933b28ef950f6de3e.jpeg) I test for the length of the addresses and it’s 58, so I’m confused. ![15906739438718080780044180309537](https://us1.discourse-cdn.com/flex016/uploads/algorand/original/1X/42bd42073b246bfaa3ff3501c8209a6909fc4fd5.jpeg)

---

<div class="post-metadata">

**Author:** ![liz](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.algorand.co/liz/32/40_2.png) [@liz](https://forum.algorand.co/u/liz)\
**Post date:** [May 28, 2020, 2:14pm UTC](https://forum.algorand.co/t/error-from-the-data-field/1698/4 "2020-05-28T14:14:06Z")

</div>

Not sure if this is the issue, but the line:

`receiver=params.get(receiver)` looks funny. If `params` is a dict of suggested parameters returned by the API, then there is no receiver field. Did you mean to just use `receiver`?

---

<div class="post-metadata">

**Author:** ![fabrice](https://avatars.discourse-cdn.com/v4/letter/f/5fc32e/32.png) [@fabrice](https://forum.algorand.co/u/fabrice)\
**Post date:** [May 28, 2020, 2:17pm UTC](https://forum.algorand.co/t/error-from-the-data-field/1698/5 "2020-05-28T14:17:20Z")

</div>

Can you try to remove

```python
receiver = params.get(receiver)

```

and print `receiver` to be sure it’s a valid address.

Note: You can copy-paste code in Forum, you just need to put them between three backquotes like ```python  
my python code  
```  
or  
```  
my result of python  
```  
It is often more convenient than images.

---

<div class="post-metadata">

**Author:** ![ddev](https://avatars.discourse-cdn.com/v4/letter/d/45deac/32.png) [@ddev](https://forum.algorand.co/u/ddev)\
**Post date:** [May 28, 2020, 2:51pm UTC](https://forum.algorand.co/t/error-from-the-data-field/1698/6 "2020-05-28T14:51:53Z")

</div>

Yes I. Did. Perhaps I should not have right?

---

<div class="post-metadata">

**Author:** ![ddev](https://avatars.discourse-cdn.com/v4/letter/d/45deac/32.png) [@ddev](https://forum.algorand.co/u/ddev)\
**Post date:** [May 28, 2020, 2:53pm UTC](https://forum.algorand.co/t/error-from-the-data-field/1698/7 "2020-05-28T14:53:20Z")

</div>

OK great noted. But I had explicitly specify the receiver since I want to send token from one account to another and to another account.

---

<div class="post-metadata">

**Author:** ![ddev](https://avatars.discourse-cdn.com/v4/letter/d/45deac/32.png) [@ddev](https://forum.algorand.co/u/ddev)\
**Post date:** [May 28, 2020, 3:08pm UTC](https://forum.algorand.co/t/error-from-the-data-field/1698/8 "2020-05-28T15:08:37Z")

</div>

I’ve removed it but getting same error as WrongKeyLengthError: Key length must be 58

---

<div class="post-metadata">

**Author:** ![fabrice](https://avatars.discourse-cdn.com/v4/letter/f/5fc32e/32.png) [@fabrice](https://forum.algorand.co/u/fabrice)\
**Post date:** [May 28, 2020, 3:15pm UTC](https://forum.algorand.co/t/error-from-the-data-field/1698/9 "2020-05-28T15:15:57Z")

</div>

Can you print `sender` and `receiver` just before the line `trxn = transaction...` and check those are valid addresses? You can do that by copy-pasting them in an Algorand explorer such as [https://goalseeker.purestake.io/algorand/testnet](https://goalseeker.purestake.io/algorand/testnet)

---

<div class="post-metadata">

**Author:** ![ddev](https://avatars.discourse-cdn.com/v4/letter/d/45deac/32.png) [@ddev](https://forum.algorand.co/u/ddev)\
**Post date:** [May 28, 2020, 4:17pm UTC](https://forum.algorand.co/t/error-from-the-data-field/1698/10 "2020-05-28T16:17:39Z")

</div>

I tried it. They’re valid addresses as shown in Image.

 ![1590681526857884990711612426231](https://us1.discourse-cdn.com/flex016/uploads/algorand/original/1X/d48c03c691968166c8ecf1cda344e04ec759b2c8.jpeg)

But if I used the full word receiver, I get this error…

 ![15906817958028895368466002773291](https://us1.discourse-cdn.com/flex016/uploads/algorand/original/1X/d5b9a063fcc821730faa2a41d5df96887b428bff.jpeg)

---

<div class="post-metadata">

**Author:** ![fabrice](https://avatars.discourse-cdn.com/v4/letter/f/5fc32e/32.png) [@fabrice](https://forum.algorand.co/u/fabrice)\
**Post date:** [May 28, 2020, 4:43pm UTC](https://forum.algorand.co/t/error-from-the-data-field/1698/11 "2020-05-28T16:43:17Z")

</div>

This is a different error, we’re progressing.  
Can you copy-paste the full code and the full reported error as a response of this post, inside a code block (i.e., between ``` and ``` in your post)?

---

<div class="post-metadata">

**Author:** ![ddev](https://avatars.discourse-cdn.com/v4/letter/d/45deac/32.png) [@ddev](https://forum.algorand.co/u/ddev)\
**Post date:** [May 28, 2020, 5:21pm UTC](https://forum.algorand.co/t/error-from-the-data-field/1698/12 "2020-05-28T17:21:32Z")

</div>

`//generateAccount.py`

````auto
from algosdk import algod
from connect import Connect

accounts = {}
# To get acount information
getConnect = Connect()
forAlcInfo = getConnect.connectToNetwork() 

# define a function to generate 2 accounts
def generateAccounts():
    # generate accounts 1 and 2
    private_key_1, address_1 = account.generate_account()
    private_key_2, address_2 = account.generate_account()
    account_1 = {
            "pkey": private_key_1,
            "alc_address":address_1,
            "alc_information": forAlcInfo.account_info(address_1)
        }
    account_2 = {
            "pkey": private_key_2,
            "alc_address":address_2,
            "alc_information": forAlcInfo.account_info(address_2)
        }
    # store accounts 1 and 2
    accounts["account_1"] = account_1
    accounts["account_2"] = account_2
    return (accounts)```

```\\sendTransaction file```

```from algosdk import algod, transaction
from connect import Connect
from generateaccount import accounts, generateAccounts

defaultAddr = "N6SJLDQXCXZ7IJMLM5VVEAWJ36JUJSDQVNQFA2I3BKFOWE3QLKKJGATPJ4"
private_key_alc = "QZkBrhS8lENmn30GyKMPufFPdjG88Knz0Fj279+jxVdvpJWOFxXz9CWLZ2tSAsnfk0TIcKtgUGkbCorrE3BalA=="

forAlgoClient = Connect()
algodClient = forAlgoClient.connectToNetwork()

fees=1000
fstRound=1000
last=fstRound + 1000,
memo = "Hi, sent you some Algo".encode()
# gn="testnet-v1.0"
genhash="SGO1GKSzyE7IEPItTxCByw9x8FmnrCDexi9/cOUJOiI="

def sendTransaction(privateKey, sender, receiver, amount):
    sndr = sender
    rcv = receiver
    amont = amount
    
    trxn = transaction.PaymentTxn(sndr, fees, fstRound, last, genhash, rcv, amont)
    signTrxn = trxn.sign(privateKey)
    # trxn_id = signTrxn.transaction.get_txid()
    return algodClient.send_transaction(signTrxn)

alc_1_addr = (accounts['account_1']['alc_address'])
alc_2_addr = (accounts['account_2']['alc_address'])
alc_1_pk = (accounts['account_1']['pkey'])

trxn_1 = sendTransaction(private_key_alc, defaultAddr, alc_1_addr, 10)

````

`error report`

````auto
Traceback (most recent call last):
  File "C:\Users\bobman\AppData\Local\Programs\Python\Python37\lib\site-packages\algosdk\algod.py", line 74, in algod_request
    raise error.AlgodHTTPError(json.loads(e)["message"])
  File "C:\Users\bobman\AppData\Local\Programs\Python\Python37\lib\json\ __init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "C:\Users\bobman\AppData\Local\Programs\Python\Python37\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Users\bobman\AppData\Local\Programs\Python\Python37\lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:/Users/bobman/Documents/pythonTutorial/pythonTutorial.py", line 33, in <module>
    trxn_1 = sendTransaction(private_key_alc, defaultAddr, alc_1_addr, 10)
  File "c:\Users\bobman\Documents\pythonTutorial\sendtransaction.py", line 30, in sendTransaction
    return algodClient.send_transaction(signTrxn)
  File "C:\Users\bobman\AppData\Local\Programs\Python\Python37\lib\site-packages\algosdk\algod.py", line 273, in send_transaction
    **kwargs)
  File "C:\Users\bobman\AppData\Local\Programs\Python\Python37\lib\site-packages\algosdk\algod.py", line 259, in send_raw_transaction
    return self.algod_request("POST", req, data=txn, **kwargs)["txId"]
  File "C:\Users\bobman\AppData\Local\Programs\Python\Python37\lib\site-packages\algosdk\algod.py", line 76, in algod_request   
    raise error.AlgodHTTPError(e)
algosdk.error.AlgodHTTPError: msgpack decode error [pos 1]: only encoded map or array can be decoded into a struct
PS C:\Users\bobman\Documents\pythonTutorial>```
````

---

<div class="post-metadata">

**Author:** ![Tim](https://avatars.discourse-cdn.com/v4/letter/t/ce73a5/32.png) [@Tim](https://forum.algorand.co/u/Tim)\
**Post date:** [May 28, 2020, 6:53pm UTC](https://forum.algorand.co/t/error-from-the-data-field/1698/13 "2020-05-28T18:53:12Z")

</div>

There is some error being returned, but likely not in JSON which the SDK is expecting.

Can you try / catch the send\_transaction statement and print the error it’ll show you what’s wrong.

For example:

```
try:
    tx_confirm = acl.send_transaction(signed_tx)
    print(tx_confirm)
except Exception as e:
    print(e)

```

Note if you are using the PureStake API, you need to include the header type with the send, something like `algod_client.send_transaction(signed_txn, headers={'content-type': 'application/x-binary'})`

---

<div class="post-metadata">

**Author:** ![ddev](https://avatars.discourse-cdn.com/v4/letter/d/45deac/32.png) [@ddev](https://forum.algorand.co/u/ddev)\
**Post date:** [May 28, 2020, 7:33pm UTC](https://forum.algorand.co/t/error-from-the-data-field/1698/14 "2020-05-28T19:33:29Z")

</div>

Yay! It worked. @Tim that’s cool one from you. Sincerely I had used the same parameter overtime before now and it never work. Perhaps I was using it wrongly. But I learned much from the error. You really helped me a lot get over this. I almost gave up cos its been 3 days now trying to solve just one issue. But I appreciate your help a lot. Thank you and to other guys who have been helpful @fabrice @liz
