-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code not executed after checker returns False #17
Comments
Hi I don't know if I understood you, but it works fine for me. An example: from mrz.checker.td3 import TD3CodeChecker
# This MRZ code should return True
mrz_td3 = ("P<CANMARTIN<<SARAH<<<<<<<<<<<<<<<<<<<<<<<<<<\n"
"ZE000509<9CAN8501019F2301147<<<<<<<<<<<<<<08")
check1 = TD3CodeChecker(mrz_td3)
if bool(check1):
print("check1 it's True")
else:
print("check1 it's False")
# Now let's introduce some errors:
mrz_td3 = ("BDBADMARTIN<<SARAH<<<<<<<<<BAD<<<<BAD<<<<<<<\n"
"ZE000509<1CAN8501019F2301147<<<<<<<<<<<<<<11")
check2 = TD3CodeChecker(mrz_td3)
if bool(check2) == True:
print("check2 it's True")
else:
print("check2 it's False") Output:
Maybe if you showed the complete code we could see where is the error. Regards! |
I have error with the following code: from mrz.checker.td3 import TD3CodeChecker
mrz_td3 = ("8053333LX2E7EZ90X2908022W6L0LL889SI95326S<2SL<\n"
"333333333333333333233D13NVL13NX35ONV0317O19SI54")
check2 = TD3CodeChecker(mrz_td3)
if bool(check2) == True:
print("check2 it's True")
else:
print("check2 it's False")`
mrz_td3 = ("P<CANMARTIN<<SARAH<<<<<<<<<<<<<<<<<<<<<<<<<<\n"
"ZE000509<9CAN8501019F2301147<<<<<<<<<<<<<<08")
check1 = TD3CodeChecker(mrz_td3)
if bool(check1):
print("check1 it's True")
else:
print("check1 it's False") Output:
|
@Arg0s1080 I modified your code to bypass all the exceptions. Btw there are some mistake in base/string_checkers.py, there is no name 's' defined in precheck() function def precheck(document_description: str, string: str, length: int):
if check_string(_check_upper(string)) and len(string) != length:
raise LengthError(cause=len(s), document=document_description, length=length)
if not is_printable(string, "\n"):
raise FieldError("%s contains invalid characters" % document_description, s) |
Hi again! In the output you can see what the error is. Your mrz string has 93 chars. MRZ code of all TD3 must be 88 chars long (89 if escape character is counted) So, as I see it, everything works fine. Regards |
Hello I have a code block like this:
The problem is when checker1 does not return True then all the lines below it won't run (the else statement never triggered).
The text was updated successfully, but these errors were encountered: