ValueError: need more than 1 value to unpack?

Hi Guys having a major problem importing the values from an external text document into my blender script.

In my script I can easily list the values like so —>

values = ((‘Value1’, “Valuename1”, “Description”),
(‘Value2’, “Valuename2”, “Description”),
(‘Value3’, “Valuename3”, “Description”),



when I try to import these values from an external *.txt document like this:

fob = open("/directory/directory.txt", “r”)
values =

and then I try to use that list I get this error message:

ValueError: need more than 1 value to unpack

I have printed both out to the console, and they come out identically I don’t know what I am missing.

I’m no expert in reading data from files, but isn’t your “values” a string when you read your file ?

if it’s supposed to be interpreted as python code, import that file, don’t read it.

CoDEmanX is right, the easiest way is to import it directly.

If you don’t want to do that, you can use the “split” function but it’s more tedious:

say your file contains this text:

myfile = open('myfile.txt', 'r')
values = []
text =
lines = text.split('
for l in lines:
    words = l.split(',')
    for w in words:

This code will return:

['value1', 'value2', 'value3', 'value4']

This problem is just python basics and unrelated to blender though, so you should read how to read files and extract data from them in other places than here…

1 Like

During a multiple value assignment, the ValueError: need more than 2 values to unpack occurs when either you have fewer objects to assign than variables, or you have more variables than objects. This error caused by the mismatch between the number of values returned and the number of variables in the assignment statement. This error happened mostly in the case of using python split function. Verify the assignment variables. If the number of assignment variables is greater than the total number of variables, delete the excess variable from the assignment operator. The number of objects returned, as well as the number of variables available are the same. This will resolve the value error.

1 Like


hopefully they solved it by now?

1 Like