jenkins-bot has submitted this change and it was merged. Change subject: Add checks for Tkinter and TkImage ......................................................................
Add checks for Tkinter and TkImage Also reorder system library imports alphabetically. Change-Id: Ia1fff760fd26985eb0557ee0117ac1e1b2b45c4d --- M scripts/flickrripper.py 1 file changed, 40 insertions(+), 20 deletions(-) Approvals: XZise: Looks good to me, approved jenkins-bot: Verified diff --git a/scripts/flickrripper.py b/scripts/flickrripper.py index d1faf67..7a372b0 100644 --- a/scripts/flickrripper.py +++ b/scripts/flickrripper.py @@ -32,16 +32,51 @@ __version__ = '$Id$' # -import re -import hashlib import base64 -import time -import sys +import hashlib import io +import re +import sys +import time + +if sys.version_info[0] > 2: + from urllib.parse import urlencode + from urllib.request import urlopen +else: + from urllib import urlencode, urlopen import pywikibot + from pywikibot import config, textlib -import upload +from scripts import upload + +try: + if sys.version_info[0] > 2: + from tkinter import ( + Tk, Label, Entry, Scrollbar, Text, Button, + END, VERTICAL, NORMAL, WORD + ) + else: + from Tkinter import ( + Tk, Label, Entry, Scrollbar, Text, Button, + END, VERTICAL, NORMAL, WORD + ) +except ImportError: + pywikibot.error( + 'This script requires Tkinter, which is typically part of Python,\n' + 'but may be packaged separately on your platform.\n' + 'See: https://www.mediawiki.org/wiki/Manual:Pywikibot/flickrripper.py') + pywikibot.exception() + sys.exit() + +try: + from PIL import Image, ImageTk +except ImportError: + pywikibot.error( + 'This script requires ImageTk from the Python Imaging Library (PIL).\n' + 'See: https://www.mediawiki.org/wiki/Manual:Pywikibot/flickrripper.py') + pywikibot.exception() + sys.exit() try: import flickrapi # see: http://stuvel.eu/projects/flickrapi @@ -50,21 +85,6 @@ pywikibot.error('See: http://stuvel.eu/projects/flickrapi') pywikibot.exception() sys.exit() - -if sys.version_info[0] > 2: - from urllib.parse import urlencode - from urllib.request import urlopen - from tkinter import ( - Tk, Label, Entry, Scrollbar, Text, Button, - END, VERTICAL, NORMAL, WORD - ) -else: - from urllib import urlencode, urlopen - from Tkinter import ( - Tk, Label, Entry, Scrollbar, Text, Button, - END, VERTICAL, NORMAL, WORD - ) -from PIL import Image, ImageTk # see: http://www.pythonware.com/products/pil/ flickr_allowed_license = { 0: False, # All Rights Reserved -- To view, visit https://gerrit.wikimedia.org/r/170894 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ia1fff760fd26985eb0557ee0117ac1e1b2b45c4d Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg <[email protected]> Gerrit-Reviewer: John Vandenberg <[email protected]> Gerrit-Reviewer: Ladsgroup <[email protected]> Gerrit-Reviewer: Merlijn van Deen <[email protected]> Gerrit-Reviewer: XZise <[email protected]> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ Pywikibot-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits
