Jump to content

  • Log In with Google      Sign In   
  • Create Account


Strange Python Syntax Error


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 boogyman19946   Members   -  Reputation: 1029

Like
0Likes
Like

Posted 17 January 2012 - 07:42 PM

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[i] == GlobalStatesAndVariables.NULL:
            continue

        index = self.keyMappings[i]
        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?
"If highly skilled generalists are rare, though, then highly skilled innovators are priceless." - ApochPiQ

My personal links :)
- Khan Academy - For all your math needs
- Java API Documentation - For all your Java info needs :D
- C++ Standard Library Reference - For some of your C++ needs ^.^

Sponsor:

#2 SiCrane   Moderators   -  Reputation: 9407

Like
2Likes
Like

Posted 17 January 2012 - 08:30 PM

Python uses not for logical not instead of !.

#3 boogyman19946   Members   -  Reputation: 1029

Like
0Likes
Like

Posted 17 January 2012 - 08:36 PM

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!
"If highly skilled generalists are rare, though, then highly skilled innovators are priceless." - ApochPiQ

My personal links :)
- Khan Academy - For all your math needs
- Java API Documentation - For all your Java info needs :D
- C++ Standard Library Reference - For some of your C++ needs ^.^




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS