https://bugzilla.wikimedia.org/show_bug.cgi?id=59970
Web browser: --- Bug ID: 59970 Summary: Show clearer error on non-recursive clone Product: Pywikibot Version: core (2.0) Hardware: All OS: All Status: NEW Severity: normal Priority: Unprioritized Component: General Assignee: Pywikipedia-bugs@lists.wikimedia.org Reporter: valhallasw@arctus.nl Classification: Unclassified Mobile Platform: ---
If someone uses 'git clone https://..../pywikibot-core' or -compat, instead of 'git clone --recursive', the bot doesn't work, due to httplib2 missing (-core) and i18n missing (core and compat). However, the errors are less than clear:
Core ---- Traceback (most recent call last): File "C:\rewrite\pwb.py", line 123, in <module> tryimport_pwb() File "C:\rewrite\pwb.py", line 30, in tryimport_pwb import pywikibot File "C:\rewrite\pywikibot__init__.py", line 412, in <module> from .page import Page, ImagePage, Category, Link, User, ItemPage, PropertyP age, Claim File "C:\rewrite\pywikibot\page.py", line 17, in <module> import pywikibot.site File "C:\rewrite\pywikibot\site.py", line 32, in <module> from pywikibot import pagegenerators File "C:\rewrite\pywikibot\pagegenerators.py", line 31, in <module> from pywikibot.comms import http File "C:\rewrite\pywikibot\comms\http.py", line 35, in <module> import queue as Queue ImportError: No module named queue
Compat ------ Traceback (most recent call last): File "replace.py", line 970, in <module> main() File "replace.py", line 636, in main {'description': u''}) File "/home/valhallasw/src/pwb/compat-svn/trunk/pywikibot/i18n.py", line 336, in twtranslate transdict = getattr(__import__("i18n", {}, {}, [package]), package).msg ImportError: No module named i18n
In both cases, we should check for the existance of the externals, and respond with a clear error message otherwise.
https://bugzilla.wikimedia.org/show_bug.cgi?id=59970
Mpaa mpaa.wiki@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |mpaa.wiki@gmail.com
--- Comment #1 from Mpaa mpaa.wiki@gmail.com --- Actually the problem seems to be the missing queue module.
In pywikibot\comms\http.py there is a try ... except ... to handle a missing hhtplib2, unless this is not updated any longer.
try: from httplib2 import SSLHandshakeError import Queue -> this looks to be preferred!! import urlparse import cookielib except ImportError: from ssl import SSLError as SSLHandshakeError import queue as Queue import urllib as urlparse from http import cookiejar as cookielib
Speaking about queue ... in different parts of pywikibot, there is a preference for "Queue" over "queue" and viceversa.
In pywikibot__init__.py there is: try: from queue import Queue -> this looks to be preferred!! except ImportError: from Queue import Queue
Sounds strange to me.
https://bugzilla.wikimedia.org/show_bug.cgi?id=59970
--- Comment #2 from Merlijn van Deen valhallasw@arctus.nl --- Both are python 2 (Queue)/ python 3 (queue) import blocks. However, the issue is *not* queue, even though the error sounds like that.
What happens is:
try: from httplib2 import SSLHandshakeError <-- fails import Queue import urlparse import cookielib except ImportError: <- this is meant for people who run python 3 from ssl import SSLError as SSLHandshakeError <-- this also works on py2 import queue as Queue <-- but this doesn't!
I think we should probably change those blocks to explicit blocks, i.e.
if sys.version_info[0] == 2: from httplib2 import SSLHandshakeError else: ...
However, that would just change the error to
Traceback (most recent call last): File "C:\rewrite\pwb.py", line 123, in <module> tryimport_pwb() File "C:\rewrite\pwb.py", line 30, in tryimport_pwb import pywikibot File "C:\rewrite\pywikibot__init__.py", line 412, in <module> from .page import Page, ImagePage, Category, Link, User, ItemPage, PropertyPage, Claim File "C:\rewrite\pywikibot\page.py", line 17, in <module> import pywikibot.site File "C:\rewrite\pywikibot\site.py", line 32, in <module> from pywikibot import pagegenerators File "C:\rewrite\pywikibot\pagegenerators.py", line 31, in <module> from pywikibot.comms import http File "C:\rewrite\pywikibot\comms\http.py", line 35, in <module> from httplib2 import SSLHandshakeError ImportError: No module named httplib2
which still needs the 'You probably forgot the submodules' clarification
https://bugzilla.wikimedia.org/show_bug.cgi?id=59970
--- Comment #3 from Mpaa mpaa.wiki@gmail.com --- Clearer now, thanks. I was missing the Python 3 ... next year may be ... :-)
https://bugzilla.wikimedia.org/show_bug.cgi?id=59970
--- Comment #4 from Gerrit Notification Bot gerritadmin@wikimedia.org --- Change 112334 had a related patch set uploaded by Merlijn van Deen: (bug 59970) Python 3 import blocks are now explicit
https://gerrit.wikimedia.org/r/112334
https://bugzilla.wikimedia.org/show_bug.cgi?id=59970
Gerrit Notification Bot gerritadmin@wikimedia.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |PATCH_TO_REVIEW
https://bugzilla.wikimedia.org/show_bug.cgi?id=59970
--- Comment #5 from Gerrit Notification Bot gerritadmin@wikimedia.org --- Change 112334 merged by jenkins-bot: (bug 59970) Python 3 import blocks are now explicit
https://gerrit.wikimedia.org/r/112334
https://bugzilla.wikimedia.org/show_bug.cgi?id=59970
--- Comment #6 from Gerrit Notification Bot gerritadmin@wikimedia.org --- Change 112336 had a related patch set uploaded by Merlijn van Deen: (bug 59970) show clear error message if httplib2 is not found
https://gerrit.wikimedia.org/r/112336
https://bugzilla.wikimedia.org/show_bug.cgi?id=59970
--- Comment #7 from Gerrit Notification Bot gerritadmin@wikimedia.org --- Change 112336 merged by jenkins-bot: (bug 59970) show clear error message if httplib2 is not found
https://gerrit.wikimedia.org/r/112336
https://bugzilla.wikimedia.org/show_bug.cgi?id=59970
xqt info@gno.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|PATCH_TO_REVIEW |RESOLVED CC| |info@gno.de Resolution|--- |FIXED
pywikipedia-bugs@lists.wikimedia.org