Kyle Sponable
Kyle Sponable

Reputation: 735

Python twisted issue

I am having an issue getting my twisted script to run its throwing a syntax error on line 13

   File "sponzyTwisted.py", line 13
   else:
   ^
   SyntaxError: invalid syntax

Here is the code as I am using it:

class printStuffs(object):
    count = 0
    def count(self):
            count += 1
            print "the counter is at" + count

class controlListener(object):
      count = 0
      def count(selt):
      if self.counter == 0:
          print "Killing Process"
          reactor.stop()
      else:
          print self.counter, '...'
          self.counter -= 1
          reactor.callLater(1, self.count)

from twisted.internet import reactor

print "Printing random stuff"
reactor.callWhenRunning(printStuffs().count)

print "Intializing kill listner"
reactor.callWhenRunning(controlListner().count)

I literally cut and pasted this code from here: http://krondo.com/our-eye-beams-begin-to-twist/

So I dont think the error is due to indenting. Thanks for reading!

Upvotes: 0

Views: 67

Answers (1)

Pythonista
Pythonista

Reputation: 11615

If this is your actual indentation, then your indentation is off.

Your statements aren't within the scope of the function.

Upvotes: 1

Related Questions