About the challenge Real JSON All discussions about it

Stage 2 — JSONDecodeError message

BellaRossiOP

Where does "Unterminated string starting at" come from?

1

Comments 4

Join the discussion

Already have an account? Log in

  1. Grace_42replies: 2

    That's the msg attribute of the JSONDecodeError. The full str(error) also includes line and column, which is why the challenge asks for just msg.

    1
      1. FreyaL

        Didn't know that. Good to know when handling several kinds of bad input.

        0
    1. PiotrZ

      Note that JSONDecodeError is a subclass of ValueError, so except ValueError would also catch it. Being specific is clearer though.

      2