Searching a document for specific strings, then print out a part of that string

So in my program im attempting to search a document called console.log that has lines like this:

65536:KONSOLL:1622118174:NSN:ActivationUnits::HandleActivationUnitsMessages. There is no handler for FNo: 34
65536:KONSOLL:1622177574:NSN:ActivationUnits::HandleActivationUnitsMessages. There is no handler for FNo: 34
65536:KONSOLL:1622190642:NSN:From AutroSafe: 28 5 2021, 08:30:42; 05.046; Service: "Self Verify" mislykket; ;  ; ProcessMsg; F:2177 L:655; 53298;1;13056;; 
65536:KONSOLL:1622204573:NSN:ActivationUnits::HandleActivationUnitsMessages. There is no handler for FNo: 34

In my input i always specify “Self Verify” as im looking after that. I want the detectornumber (05.046) on the output. But i get a error.

This is my code:

import os
import re

pattern = input("What are you searching for? -->")
detectorPattern = re.compile(r'dd.ddd')
directory = os.listdir()
for x in range(len(directory)):
    with open(directory[x], 'r') as reader:
        print("Opening " + directory[1])
        # Read and print the entire file line by line
        for line in reader:
            findLine = re.search(pattern, line)
            if findLine is not None:
                mo = detectorPattern.search(findLine)
                print(mo.group())

So what im trying to do is to to go for one line, and if i find “Self Verify” i will search that line for the detector specified in detectorPattern, and print that one out.

This is the error i get:

Traceback (most recent call last):
  File "C:UsersharalDesktopPPSVFinder.py", line 14, in <module>
    mo = detectorPattern.search(findLine)
TypeError: expected string or bytes-like object

Answer

Change:

mo = detectorPattern.search(findLine)

To:

mo = detectorPattern.search(findLine.string)

This will print:

162219

when executing the line:

print(mo.group())