Revision: 7214 Author: alexsh Date: 2009-09-06 14:16:31 +0000 (Sun, 06 Sep 2009)
Log Message: ----------- terminal_interface.UI().askForCaptcha(): fix url show and handle web browser open failure.
Modified Paths: -------------- trunk/pywikipedia/userinterfaces/terminal_interface.py
Modified: trunk/pywikipedia/userinterfaces/terminal_interface.py =================================================================== --- trunk/pywikipedia/userinterfaces/terminal_interface.py 2009-09-05 12:45:15 UTC (rev 7213) +++ trunk/pywikipedia/userinterfaces/terminal_interface.py 2009-09-06 14:16:31 UTC (rev 7214) @@ -287,8 +287,11 @@ try: import webbrowser wikipedia.output(u'Opening CAPTCHA in your web browser...') - webbrowser.open(url) - return wikipedia.input(u'What is the solution of the CAPTCHA that is shown in your web browser?') + if webbrowser.open(url): + return wikipedia.input(u'What is the solution of the CAPTCHA that is shown in your web browser?') + else: + raise except: wikipedia.output(u'Error in opening web browser: %s' % sys.exc_info()[0]) - return wikipedia.input(u'What is the solution of the CAPTCHA at %s ?' % url) + wikipedia.output(u'Please copy this url to your web browser and open it:\n %s' % url) + return wikipedia.input(u'What is the solution of the CAPTCHA at this url ?')
pywikipedia-svn@lists.wikimedia.org