Last modified: 2014-02-09 15:45:32 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T61970, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 59970 - Show clearer error on non-recursive clone
Show clearer error on non-recursive clone
Status: RESOLVED FIXED
Product: Pywikibot
Classification: Unclassified
General (Other open bugs)
core-(2.0)
All All
: Unprioritized normal
: ---
Assigned To: Pywikipedia bugs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-01-12 12:23 UTC by Merlijn van Deen (test)
Modified: 2014-02-09 15:45 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Merlijn van Deen (test) 2014-01-12 12:23:49 UTC
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.
Comment 1 Mpaa 2014-01-12 20:20:53 UTC
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.
Comment 2 Merlijn van Deen (test) 2014-01-12 20:36:41 UTC
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
Comment 3 Mpaa 2014-01-12 20:40:22 UTC
Clearer now, thanks. I was missing the Python 3 ... next year may be ... :-)
Comment 4 Gerrit Notification Bot 2014-02-09 12:49:29 UTC
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
Comment 5 Gerrit Notification Bot 2014-02-09 12:52:26 UTC
Change 112334 merged by jenkins-bot:
(bug 59970) Python 3 import blocks are now explicit

https://gerrit.wikimedia.org/r/112334
Comment 6 Gerrit Notification Bot 2014-02-09 13:24:06 UTC
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
Comment 7 Gerrit Notification Bot 2014-02-09 15:42:50 UTC
Change 112336 merged by jenkins-bot:
(bug 59970) show clear error message if httplib2 is not found

https://gerrit.wikimedia.org/r/112336

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links