Forums

Adding indented code breaks script?

I was trying to edit my python app a bit ago, and the editor is showing some screwy behavior. Any place I add code, it shows a "syntax error" on the first line, and it only does this on lines of code that are indented.

I thought it was a fluke, but when I reload the app, all requests to it fail upon reaching the affected section of code.

I've already done several sanity checks from multiple angles to make sure the indentation is correct, but the error still occurs.

Have you mixed tabs and spaces?

Also. check there's not a missing ':' from the previous line.

That was included in my rounds of sanity checks, and I tried doing it in several different areas of the script. I even copied and pasted one line of code (tabs and line feed included) and it still had the problem.

Well, here's something interesting, if I copy the entire script, delete it, and then paste it back, then everything works as expected.

Hmm... does sound like there was some strange unprintable character in the mix. Glad you got it working again. We'll keep an eye out for the problem.