Can someone correct my syntax please?

This code :

self.cement.actorInterval("cementAn%" % self.action, playRate = 1 ).start()

produces this error :

self.cement.actorInterval("cementAn%" % i, playRate = 1 ).start()
ValueError: incomplete format

self.action is a variable, so for example if self.action == 1, I want cementAn1 to start playing. I guess my syntax must be wrong somewhere… any ideas?


You missed the string format :

"cementAn%s" % self.action


Works perfectly.