[Python] Is there a way to turn off Python's "Did you mean...?" guessing feature appended to...

Discussão em 'Python' iniciado por Stack, Junho 1, 2025.

  1. Stack

    Stack Membro Participativo

    Since I upgraded my Python, error messages have become more difficult for me to read.

    I understand that this is a popular feature for many people, but for me it is not. It gives me more text to read through, and it causes me to loose my (coding) train of thought because it makes me to shift to conversational mode. Once I have identified the part that's talking to me as if the error message were a person, I can then block it out mentally and visually, and only then find the actual error message.

    Is there a way to turn off Python's "Did you mean...?" guessing feature appended to error messages?

    In this case the guess is particularly "lame" because np or numpy is a library I'd imported, it would not be an argument of range() whereas nx (defined just two lines earlier) would have been an obvious (and correct) guess.

    for i in range(n):
    ^
    NameError: name 'n' is not defined. Did you mean: 'np'?

    Continue reading...

Compartilhe esta Página