I'm trying to understand the error below from Flake8:
no newline at end of fileFlake8(W292)
This is my code below:
if __name__ == "__main__":
app.run(
host=os.environ.get("IP", "0.0.0.0"),
port=int(os.environ.get("PORT", "5000")),
debug=False)
And, the error is pointing to the last line below:
debug=False
Can someone help explain to me why I'm getting this invalid error and offer a solution to solve it. Thanks
It means exactly what it says. There is no recognizable newline at the end of the file. The last character is the
)... or maybe aTAB, orSPACE, or a line terminator for a different platform.Solution: open the file in an editor, add a newline at the end, save and close the file.
So what you had was a line consisting of white space (SPACE or TAB characters) followed by a newline. Use your editor to get rid of that line.
The style checker wants the last line of the file to end with the newline character, and to have no trailing whitespace on that line.