Steps to replicate the issue (include links if applicable):
import re text = 'abcd' pat = re.compile('z') m = pat.search(text) In [11]: m.group() --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) Input In [11], in <cell line: 1>() ----> 1 m.group() AttributeError: 'NoneType' object has no attribute 'group' In [12]: m[0] --------------------------------------------------------------------------- TypeError Traceback (most recent call last) Input In [12], in <cell line: 1>() ----> 1 m[0] TypeError: 'NoneType' object is not subscriptable
What happens?:
Scripts might not catch the right Exception after https://gerrit.wikimedia.org/r/c/pywikibot/core/+/836138