Q:

Python indentation not intuitive

I am trying to follow proper protocol for Python indentation, but still python throws an error.  I am sure python has good reason and my code is just bad, but I fail to see the root cause. 
When run the error is pointed to the last line
~/python $ ./hover_api_v1.0.py
  File "./hover_api_v1.0.py", line 139
    time.sleep(60.0)
    ^
IndentationError: expected an indented block

Below is my code.  There are some headers not relevant for indentation. 
The error is thrown at the last line with the time command.  But I fail to see my mistake in the code.  The time cmd is part of the top while loop and properly indented. 
while True:
    ip_now = get_asus_wan_ip()
    if (ip_now == ip_last):
        day = datetime.datetime.now().day
        if day ! = last_day:
            last_day = day
            with open(logfile, "a") as lf:
                lf.write(time.strftime("%Y-%m-%d %H:%M:%S") + " WAN IP still the same " + str(ip_last) +"\n")

    else:
        # We need to do something
        #print('WAN IP changed from ' + str(ip_last) + " to " + str(ip_now))
        with open(logfile, "a") as lf:
            lf.write(time.strftime("%Y-%m-%d %H:%M:%S") + " WAN IP changed from " + str(ip_last) + " to " + str(ip_now) + "\n")
        ip_last= ip_now

        # connect to API
        client = HoverAPI('XXXXXXX','YYYYYYY')
        for dnsname in ['*.zzzzz.zzz', '@.zzzzz.zzz']:
            #print('Testing: ' + dnsname)
            dns_name, domain_name = dnsname.split('.',  1)

            # get all DNS records
            result = client.call("get", "dns")
            assert result['succeeded'], result

            # discover existing dns record, if any
            dns_record = None
            domain_record = None
            for dns_domain in result['domains']:
                if dns_domain['domain_name'] == domain_name:
                    domain_record = dns_domain
                    for dns_entry in dns_domain['entries']:
                        if dns_entry['name'] == dns_name:
                            dns_record = dns_entry
                            break
                if dns_record is not None and domain_record is not None:
                    break

            if dns_record is not None and domain_record is not None:
                #print('Hover-IP for ' + dnsname + ' = ' + str(dns_entry['content'].encode('ascii','ignore')))
                #print('Current IP= ' + str(ip_now))
                if str(dns_entry['content']) == str(ip_now):
                    #print('Hover-IP for ' + dnsname + ' = ' + str(dns_entry['content'].encode('ascii','ignore')) + ' same as Current IP = ' + str(ip_now) + '.  No action.') 
                    with open(logfile, "a") as lf:
                        lf.write(time.strftime("%Y-%m-%d %H:%M:%S") + " Hover-IP for " + dnsname + " = " + str(dns_entry['content'].encode('ascii','ignore')) + " same as Current IP = " + str(ip_now) + ".  No action."  + "\n")
                else:
                    #print(" Deleting entry for {0}.{1} ... ".format(dns_name, domain_name), end="")
                    with open(logfile, "a") as lf:
                        lf.write(time.strftime("%Y-%m-%d %H:%M:%S") + " Deleting entry for " + dnsname + "\n")
                    result = client.call("delete", "dns/{0}".format(dns_record['id']))
                    assert result['succeeded'], result
                    #print("OK")
                    ## create a new A record:
                    #print("Creating A record {0}.{1} => {2} ... ".format(dns_name, domain_name, ip_now), end="")
                    with open(logfile, "a") as lf:
                        lf.write(time.strftime("%Y-%m-%d %H:%M:%S") + " Creating A record " + dnsname + " => " + ip_now + "\n")
                    record = {"name": dns_name, "type": "A", "content": ip_now}
                    post_id = "domains/{0}/dns".format(domain_record['id'])
                    #print("post", post_id, record)
                    result = client.call("post", post_id, record)
                    assert result['succeeded'], result
                    #print("OK")
            else:
                #print("No record exists for {0}".format(dnsname))

    # Sleep at end of loop. 
    time.sleep(60.0)

Feedback is much appreciated. 
Gert

A:

The problem is here;
else:
    #print("No record exists for {0}".format(dnsname))

Comments do not count as code as far as indention is considered. 
So you need to have real code in that spot. 
A way around this is python's pass keyword. 
else:
    #print("No record exists for {0}".format(dnsname))
    pass

This signals to python that you have intentionally left the code required at that indentation level empty. 
Alternatively, simply uncommenting the code you have there would also solve this problem, assuming of course you actually want to print there.