-2
  File "game.py", line 81, in <module>
  File "game.py", line 33, in start
    if a == "User name or Password is incorrect!":
ValueError: too many values to unpack (expected 2)

Here is the code generating the error:

choice = input("> ")
    if choice == "1":
        clear()
        User=input("User Name: ")
        Password=input("Password: ")
        a, b=login(User, Password)
        if a == "User name or Password is incorrect!":
            print("User name or Password is incorrect!")

Here is that file.

Here is the full code.

Sorry it's really long, I was writing a long code and got this error

  • please post the minimal context for this error. Ideally, we'd like to see where `a` comes from and some of of the lines around this, since I would not expect this ValueError to be thrown by a comparison of some variable to a string. – Jon Kiparsky Oct 24 '19 at 21:11
  • Where's the code for the `login()` function? – iScripters Oct 24 '19 at 21:11
  • in a different file. It's 5 files of long code. – Hudson Gouge Oct 24 '19 at 21:11
  • Welcome to StackOverflow. Please read and follow the posting guidelines in the help documentation, as suggested when you created this account. [Minimal, complete, verifiable example](https://stackoverflow.com/help/minimal-reproducible-example) applies here. We cannot effectively help you until you post your MCVE code and accurately specify the problem. We should be able to paste your posted code into a text file and reproduce the problem you specified. – Prune Oct 24 '19 at 21:29
  • Welcome to SO! When you place a question try to add a minimum content: input sample, expected output sample, what did you try, research and where are you stuck. Your question is not clear, show us what did you try and your research and take a look to Prune comment. – David García Bodego Oct 27 '19 at 03:13

1 Answers1

3

I believe the error is actually on the previous line:

a, b=login(User, Password)

This code expects login() to return a sequence of exactly two items. But it returned more than that, thus the error.

John Gordon
  • 29,573
  • 7
  • 33
  • 58