IndentationError: expected an indented block but it's there

JackM notreal at earthlink.net
Tue May 28 11:32:06 EDT 2013


Having a problem getting a py script to execute. Got this error:

File "/scripts/blockIPv4.py", line 19
     ip = line.split(';')[0]
      ^
IndentationError: expected an indented block


I'm perplexed because the code that the error refers to *is* indented:



with open('/var/www/html/mydomain.com/banlist.txt','r') as inFile:
     for line in inFile.readlines():
         ip = line.split(';')[0]
         output = os.popen( '/etc/sysconfig/iptables -A INPUT -s ' + ip 
+ ' -j REJECT' )
         logFile.write(ip+' - Has been blocked\n')


What am I missing here?




-- 
My email address on the header is a non-monitored spam catching account. 
I can be reached via http://www.wvnh.net/contact.htm



More information about the Python-list mailing list