Oliver Bird Oliver Bird - 2 months ago 12
Python Question

What's wrong with here? Python2 ->Python3

I'm practicing Python with the book called Learn "Python The Hard Way 3rd edition". I searched that this book is a good resource to get a start.

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 I got an error saying that
value error: not enough values to unpack (expected 4, got 1)
.

Answer Source

You need to run the script with three arguments, so that argv contains four elements (the first is the script's name).