jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/355902 )
Change subject: T166459: Fix ResourceWarning in wikimedia_sites.py ......................................................................
T166459: Fix ResourceWarning in wikimedia_sites.py
Fix ResourceWarning in wikimedia_sites.py with python3.
Bug: T166459 Change-Id: I87ae7ce622c0e3b3d4fd2351dfa606562dc69e44 --- M scripts/maintenance/wikimedia_sites.py 1 file changed, 2 insertions(+), 3 deletions(-)
Approvals: jenkins-bot: Verified Xqt: Looks good to me, approved
diff --git a/scripts/maintenance/wikimedia_sites.py b/scripts/maintenance/wikimedia_sites.py index dc72510..a9df474 100755 --- a/scripts/maintenance/wikimedia_sites.py +++ b/scripts/maintenance/wikimedia_sites.py @@ -89,9 +89,8 @@ old = re.findall(r'(?msu)^ {8}self.languages_by_size.+?]', family_text)[0] family_text = family_text.replace(old, text) - family_file = codecs.open(family_file_name, 'w', 'utf8') - family_file.write(family_text) - family_file.close() + with codecs.open(family_file_name, 'w', 'utf8') as family_file: + family_file.write(family_text)
if __name__ == '__main__':
pywikibot-commits@lists.wikimedia.org