Why is this a syntax error?


I’m a total noob with MicroPython. I’m trying to do something I expect would be easy, but I get a syntax error for .
Here’s the snippet that fails. It’s actually the second line that generates the error.

if(stdin.buffer.any() > 34)

data = stdin.buffer.readline() 

The error is;
Traceback (most recent call last):
File “”, line 108
SyntaxError: invalid syntax

Thanks in advance if you don’t mind helping me out.

The forum mangled your code but I’ll make a best-effort guess.

Your if statement doesn’t look right; it does not end with a colon. Syntactically it should be if (stdin.buffer.any() > 34):

Try that, but I also suspect your if statement itself won’t work…never seen any used like that.