Forums

Type as the book said, but it didn't work

I typed this:

from sys import argv
script, first, second, third = argv
print"The script is called:", script
print"Your first variable is:", first
print"Your second variable is:", second
print"Your third variable is:", third

and it said this:

ValueError: need more than 1 value to unpack

[edit by admin: formatting]

How did you run the script? Are you sure you ran it in exactly the way the book said?

yes

what does the error mean? Where did I do wrong?

The error means that there were not 4 elements in argv, so it cannot unpack them in the 4 variables that you've tried to unpack it into. Pass 3 arguments into the script so that argv will have some additional elements in it.