Well, you know what they say, 'never trust the user input'. Even if the user is, well, yourself.
The statement: input("Enter the first integer: ")
returns a string (the one you typed), which, in turn, passed to int() is attempted to be converted to an integer.
It is a requirement of int function, when given a string as input, that this string is strictly a depiction of an integer (and not a floating point number, like, say, 2.2)
You can experiment with the very first line: num1 = int(input("Enter the first integer: ")) then print(num1) to figure out how this works for yourself; when it raises and when not.
The problem in the code you posted is that you first try to convert to an int, and later check if the input was actually an int. So, Python interpreter had to face the problem first and used it's own, automatic way to report it: an exception.
A way to come around this could be to postpone the string -> int coversion until it is actually needed. Luckily, that's only one place, in the comparison, which would then become: if int(num1) > int(num2): .
That would spare you the trouble from the int() conversions in the beginning, plus the back-to-string conversions for int-checking ( if (str(num1).isdigit()) and (str(num2).isdigit()): could just become if num1.isdigit() and num2.isdigit(): since num1, num2 have not been coverted yet. )
Alternatively, if you want decimal point numbers to be converted without errors, you can use the float() function (which can conveniently convert an int as well).
You can also try to use exception handling, such as:
try:
num1 = int(input("Enter the first integer: "))
num2 = int(input("Enter the second integer: "))
except Exception as e:
print("Error converting input to integers", e)
which would in turn, spare you from the need of validating the input below...