Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23131

How to debug indentation errors in python [duplicate]

$
0
0

I am trying to write my very first python script. This was working but then after some slight refactoring I have, apparently, broken the indentation. I can not determine what is the problem. The interpretor complains about the following method. Can someone point it out?

def dataReceived(self, data):    a = data.split(':')    print a    if len(a) > 1:        command = a[0]        content = a[1]        msg = ""        if command == "iam":            self.name = content            msg = self.name +" has joined"        elif command == "msg":            msg = self.name +": "+ content            print msg

The error reads: File "python_server.py", line 17 a = data.split(':') ^ IndentationError: expected an indented block


Viewing all articles
Browse latest Browse all 23131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>