The operation add items to list cannot accept the arguments

Hii. I am trying to add some values to a list so it could be stored in the TinyDB and I could show those values in another screen. But the message "The operation add items to list cannot accept the arguments" is showing, no matter how many times I try to fix it.

Can anybody help me?


global LivrosDe is not a list now (even though you set it as one to begin with)

1 Like

What can I do to solve it?
Sorry, I am not very good at it.


as Tim has pointed you, if you want to handle "LivrosDe" like a list, then to add elements to the list, you need to use the "add items to list" block, instead of to set directly a string to it.

1 Like

I was useing the string only to make the title of the list change as the name of the user changes.
I changed the code make a list "global LivrosDe" and the i used the add items to list "global LivrosDe" with all the items of the first image I showed.
What I want is: To make a list with the title "LivrosDe" + name of user that has loggedIn and add a value to all the items I listed.
How can I do that?

List have not "title". You can create a List of List, or use a dictionary or use the name of the user like Tag to store the list of books associated to the user so, with the username, you can easily recover his/her list of books, display it, or add elements to it.

So, using the username like Tag, if you are passing in the "start value" the username, you can get the list of books for that user in Initialize block:

To manipulate list in tinyDB you need first to recover it, then update (add/modify/remove elements) the list, and then store the list again.

1 Like

Additionally, some tips on how to correctly switch from one screen to another:

1 Like

Thank you very much for helping me!

That´s what I changed. And the notifier says it did sign in the book.
Now I want to show how many books a pearson have added to their shelf in another screen.

I dont think I am doing it right :frowning:
Sorry if I am bodering you, but I need to make it work for University.

What problem do you have?

I am adding books to the user, but the number o books added to that account doens´t change.

In "Leitura" screen, each time you are adding a book, you are overwriting the I told you above, you need first to recover the list from TinyDB, then add the new item to the list, and store it again (under the same Tag). In this way, the stored list will contain the new book.
A simple example:

1 Like

I changed what you said, but it still didn´t work. Do you think it could be because of the name that I am giving to the TAG?
My teacher uses append to list in every screen, but when I did, it showed an error message.

Yes, the tag must be the same when Getting and when storing (in all the screens you want to access to the same data).

If you want to use this Tag:

then use it also when getting the value.

Other good thing while testing, it is to clean the tags (or even the entire tinyDB) between tests, to ensure that no invalid data is left between tests (you have blocks for this purpose in tinyDB).

1 Like

I used this to see if the list was empty of not. It didnt write DESGRAÇA, but appeared an error saying you cant pick a random item of a list that is empty

Like you are handling a list, use this block:

Yes, you are right! :dizzy_face:
But why, when I enter a book, the list keep staying empty?

Check you are using the same tags in all the accesses to tinyDB. Check also in all the screens you are using the same namespace:


1 Like

You are the beesstt!!
Thank you very much!!!!
I had changed the name in the first page that I created and forgot about it.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.