Strange Python Syntax Error

Started by
1 comment, last by boogyman19946 12 years, 3 months ago
I've been rewriting my code to use an already existing scripting language as opposed to extending the one I already had and I'm about to give it a run for the first time but I'm facing a strange issue.

The script interpreter is throwing an exception complaining about character mismatch which doesn't really make sense. Here is the exact error line as returned to me by the JVM:

Exception in thread "main" SyntaxError: ("mismatched character 's' expecting '='", ('<iostream>', 44, 49, '\t\t\tif (GlobalStatesAndVariables.keys[index] and !self.mProcessedKeys[index]):\n'))


and here is the allegedly offending code:



def ProcessKeys(self):
for i in range(MotionModule.NUM_OF_IDS):
if self.keyMappings == GlobalStatesAndVariables.NULL:
continue

index = self.keyMappings
if (GlobalStatesAndVariables.keys[index] and !self.mProcessedKeys[index]): # the error points between 'n' and 'd' of the first index variable
self.mEntity.mMotionModule.SetMotion(i, true)
self.mProcessedKeys[index] = true
elif (!GlobalStatesAndVariables.keys[index] and self.mProcessedKeys[index]):
self.mEntity.mMotionModule.SetMotion(i, false)
self.mProcessedKeys[index] = false


I can't put my finger on what the interpreter is complaining about. Any ideas?

Yo dawg, don't even trip.

Advertisement
Python uses not for logical not instead of !.
oh man, I feel really dumb for not being aware of that. It would've taken me a good wall-headbutt or two before noticing that one. Thanks SiCrane!

Yo dawg, don't even trip.

This topic is closed to new replies.

Advertisement