Dictionary error "not a well-formed list"

error showing now " List of pairs to dict: the list [{"Name":"ghea"}] is not a well-formed list of pairs
Note: You will not see another error reported for 5 seconds."

ive been working on this for a few days and cannot seem to get around this.

i have 42 text fields persist so im saving them to a keys, then the keys to a list, and then the list to TinyDB. the TinyDB is popultated with the text.

i am able to get the text from the TinyDB but when i try to pass the text into a new variable empty dictionary, i get the error.

I found the problem. the value for that tag isn't a dictionary

1 Like

i thought a tag was a text field only as a unique identifier af a set of data in Tiny DB. does it have format?

oh sorry. the value for the tag is not a dictionary

1 Like

It's a list with the item being the dictionary. got to be a dictionary
wrong :


right:

1 Like

the value is saved as a list of pairs from dictionary
it is retrieved as a list of pairs into a dictionary

nope. It's something like this

If it is a list of pairs, it would be some thing like this:

if it is retrieved as a list, and your trying to converting it to a dictionary,
use dictionaries_alist_to_dict instead of dictionaries_dict_to_alist where the error pops.

1 Like

Export your .aia file and upload it here.
export_and_upload_aia

1 Like

give me a few minutes to clean up some of my debugging and i will post file

cleaning up has resolved the issue, i have an idea why but im now not sure. please feel free to delete this topic. i will delete it if i am able.

thank you guys for helping

It would be more helpful to post where your app went wrong, so others could benefit.

Your dictionary pairs are inside a list, you will need to get the first item of the list (your dictionary) then you can do the list of pairs thing:

list = [{"Name":"ghea"}]
select index 1 from list = {"Name":"ghea"}   << a dictionary

I have not tested whether {"Name":"ghea"} is just a string, and needs encoding to a dictionary

1 Like

Coldstone2.aia (571.1 KB)

it seems that my blocks showing error were working correctly but the blocks where the TinyDB were saved were at issue.

during my debugging i broke the edit procedure into several smaller procedures. i moved them back into the main routine cleaning up but that didnt resolve issue.

the save procedure is where i resolved the issue, and that came from using a key for validating rather than its counterpart text field. the keys are cleared out in my code to prevent orphans. all of this code is reused over with different items in a list so my list of lists of lists of lists is becoming mind boggling

Yes, that's right! (I said this before)

don't delete it, mark post 10 or 8 as the solution

this may be a good point at which ta poll if what im doing is effective to manage my data
to clarify i will use user inputs as entry by the user of the app and not coded in. programmer writes the info that cannot be changed after the build

in this app:
user inputs data for each device(about 50 fields)
user inputs multiple devices into a list

nothing difficult there. i originally put the data into the device1DB and device2DB. issue was all my data is showing in all namesDB, even if you rename the DB it all still pools into a single TinyDB, so if i write all the fields to device1DB if overwrites the data that i saved for device2DB.

renaming or giving unique tags to each of the fields for each of the devices was an option, but that seems to be exactly what the dictionary is for.

The TinyDB NameSpace feature lets you keep different instances of TinyDB, with no worries about tag overlap.

So you could keep a separate TinyDB for each piece of equipment, with its own Namespace.


before and after, i did not change these blocks