IndentationError: expected an indented block but it's there

2013-05-28 Thread JackM
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/

Re: Read txt file, add to iptables not working on new host

2013-05-24 Thread JackM
File: # TODO: Use 'with' for a bit of protection ip = line.split(';')[0] output = os.popen( '/sbin/iptables -A INPUT -s ' + ip + ' -j REJECT' ) logFile.write(ip+' - Has been blocked\n') On 5/24/2013 9:54 AM, Chris An

Re: Read txt file, add to iptables not working on new host

2013-05-24 Thread JackM
Thanks for answering. Do you mean something like this? outPut = os.popen('uname -a' '/sbin/iptables -V INPUT -s' + ' ' + IP + ' ' + '-j REJECT' ) Sorry but like I said, I have no experience with any of this. On 5/23/2013 11:10 PM, Carlos Nepomuceno wrote: Send the output of the following

Read txt file, add to iptables not working on new host

2013-05-23 Thread JackM
First, let me say that I have no knowledge of or experience with Python or Linux/Unix. I have a script which was written by a host tech person that ran via cron on my old server. It was designed to read IP addresses from a text file and add them to be blocked on iptables. That way, we could add