There's no result from search so there's nothing to call start() on. Impossible to debug further without knowing what pattern and bytes are. Also, you shouldn't be using bytes as a variable name since it's the name of a builtin type.
match = re.search(pattern, bytes)
if match != None:
print("Match at index %s, %s" % (match.start(), match.end()))
else:
print("The regex pattern does not match.")
searchso there's nothing to callstart()on. Impossible to debug further without knowing whatpatternandbytesare. Also, you shouldn't be usingbytesas a variable name since it's the name of a builtin type.Noneis returned not aMatchobject