IndentationError: unindent не соответствует ни одному внешнему уровню отступа? Неизвестно почему - PullRequest
0 голосов
/ 21 февраля 2020

У меня проблема с моей программой traceroute, в которой говорится, что у меня ошибка отступа, но я знаю, что все отступы выполнены правильно. Найдите приведенный ниже фрагмент кода:

def receiveOnePing(icmpSocket, destinationAddress, ID, timeout):
    icmpSocket.settimeout(1)
    try:
        # 1. Wait for the socket to receive a reply
        tempBytes, receivingAddress = icmpSocket.recvfrom(1024)
        # 2. Once received, record time of receipt, otherwise, handle a timeout
        receivedTime=time.time() * 1000
        # 3. Compare the time of receipt to time of sending, producing the total network delay
        delay = receivedTime - SendTime
        # 4. Unpack the packet header for useful information, including the ID
        icmpHEADER = tempBytes[20:28]
        icmpTYPE, icmpCODE, icmpCHECKSUM, icmpPACKETID, icmpSEQUENCE = struct.unpack("bbHHh", icmpHEADER)

        return (delay, receivingAddress[0])

    except socket.timeout as e:
        return("*", None)

Ошибка влияет на строку с "try:". Я, вероятно, глуп, но, похоже, я не могу обнаружить ошибки отступа.

...