Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (47.6k points)

In Python, when I run this code:

from sys import argv 

script, user_name =argv 

prompt = '>' 

print "Hi %s, I'm the %s script." % (user_name, script)

I get this error:

Traceback (most recent call last): 

script, user_name =argv 

ValueError: need more than 1 value to unpack

What does that error mean?

1 Answer

0 votes
by (106k points)

Probably you didn't provide an argument on the command line. In that case, sys.argv only contains one value, but it would have to have two in order to provide values for both user_name and script.

Related questions

0 votes
1 answer
asked Feb 3, 2021 in Python by laddulakshana (16.4k points)
0 votes
1 answer
asked Aug 26, 2019 in Python by Sammy (47.6k points)
0 votes
1 answer

Browse Categories

...