jenkins-bot has submitted this change and it was merged.

Change subject: Added Exception handling in flickrripper.py for text interface
......................................................................


Added Exception handling in flickrripper.py for text interface

Flickrripper.py now automatically shifts to autonomous mode when gui.py
throws an exception.

Change-Id: I6de5626d5c54101490db2d5f857172085ba558af
---
M scripts/flickrripper.py
1 file changed, 9 insertions(+), 2 deletions(-)

Approvals:
  John Vandenberg: Looks good to me, approved
  Legoktm: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/scripts/flickrripper.py b/scripts/flickrripper.py
index fb33cd8..7a4fc9e 100644
--- a/scripts/flickrripper.py
+++ b/scripts/flickrripper.py
@@ -58,7 +58,10 @@
 from pywikibot import config, textlib
 from scripts import upload
 
-from pywikibot.userinterfaces.gui import Tkdialog
+try:
+    from pywikibot.userinterfaces.gui import Tkdialog
+except ImportError as _tk_error:
+    Tkdialog = None
 
 
 flickr_allowed_license = {
@@ -291,7 +294,7 @@
                                                 override, addCategory,
                                                 removeCategories)
             # pywikibot.output(photoDescription)
-            if not autonomous:
+            if Tkdialog is not None and not autonomous:
                 try:
                     (newPhotoDescription, newFilename, skip) = Tkdialog(
                     photoDescription, photo, filename).run()
@@ -299,6 +302,10 @@
                     pywikibot.warning(e)
                     pywikibot.warning('Switching to autonomous mode.')
                     autonomous = True
+            elif not autonomous:
+                pywikibot.warning('Switching to autonomous mode because GUI 
interface cannot be used')
+                pywikibot.warning(_tk_error)
+                autonomous = True
             if autonomous:
                 newPhotoDescription = photoDescription
                 newFilename = filename

-- 
To view, visit https://gerrit.wikimedia.org/r/181903
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I6de5626d5c54101490db2d5f857172085ba558af
Gerrit-PatchSet: 11
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Anshoe <[email protected]>
Gerrit-Reviewer: Anshoe <[email protected]>
Gerrit-Reviewer: John Vandenberg <[email protected]>
Gerrit-Reviewer: Ladsgroup <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Merlijn van Deen <[email protected]>
Gerrit-Reviewer: XZise <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to