jenkins-bot submitted this change.
[bugfix]: Catch TypeError instead of AttributeError
Catch the correct exception when match object is None.
Regression after I2e3e4073d317eb23b7ba040642e82edfbe471cdd
Bug: T319132
Change-Id: I02e8358ee4694f90dc0d1400fbca93e92829b4d5
---
M scripts/pagefromfile.py
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/scripts/pagefromfile.py b/scripts/pagefromfile.py
index 4a564d5..8705099 100755
--- a/scripts/pagefromfile.py
+++ b/scripts/pagefromfile.py
@@ -217,7 +217,7 @@
while text:
try:
length, title, contents = self.findpage(text)
- except AttributeError:
+ except TypeError:
if not length:
pywikibot.info('\nStart or end marker not found.')
else:
@@ -246,7 +246,7 @@
+ re.escape(self.opt.titleend))
location = page_regex.search(text)
if self.opt.include:
- contents = location.group()
+ contents = location[0]
else:
contents = location[1]
@@ -257,7 +257,7 @@
if self.opt.notitle:
# Remove title (to allow creation of redirects)
contents = title_regex.sub('', contents, count=1)
- except AttributeError:
+ except TypeError:
raise NoTitleError(location.end())
return location.end(), title, contents
To view, visit change 837203. To unsubscribe, or for help writing mail filters, visit settings.