jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/463599 )
Change subject: scripts/imagecopy.py: Do not create Uploadbot.localskips.txt on loading ......................................................................
scripts/imagecopy.py: Do not create Uploadbot.localskips.txt on loading
Only create the file if the module is being run as the main module.
Bug: T205772 Change-Id: Ifd8be27b5f2a213c94b1db96ede7fa48ade8fbd6 --- M scripts/imagecopy.py 1 file changed, 9 insertions(+), 7 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/scripts/imagecopy.py b/scripts/imagecopy.py index 21f78ec..4e8f70f 100644 --- a/scripts/imagecopy.py +++ b/scripts/imagecopy.py @@ -372,12 +372,13 @@ return pageText
-# -label ok skip view -# textarea -archivo = config.datafilepath('Uploadbot.localskips.txt') -if not path.exists(archivo): - with open(archivo, 'w') as tocreate: - tocreate.write('{{NowCommons') +def load_global_archivo(): + """Load/create Uploadbot.localskips.txt and save the path in `archivo`.""" + global archivo + archivo = config.datafilepath('Uploadbot.localskips.txt') + if not path.exists(archivo): + with open(archivo, 'w') as tocreate: + tocreate.write('{{NowCommons')
def getautoskip(): @@ -495,7 +496,6 @@
def main(*args): """Process command line arguments and invoke bot.""" - imagepage = None always = False category = '' delete_after_done = False @@ -518,6 +518,8 @@ pywikibot.bot.suggest_help(missing_generator=True) return False
+ load_global_archivo() + for page in pregenerator: skip = False if page.exists() and page.namespace() == 6 \
pywikibot-commits@lists.wikimedia.org