jenkins-bot merged this change.

View Change

Approvals: Dalba: Looks good to me, approved jenkins-bot: Verified
[cleanup] Remove old httplib2 code part

- with 2.0 release httplib2 was used instead of requests and
externals/httplib2 was loaded package of that name, even if
the directory was empty because the user has not cloned the
git sub-modules.

Now under 3.0 release we haven't that externals package anymore
but a side package with requests and it is no longer needed to
check the __version__ string.

- Also simplify pwb assignment in tryimport procedure.

Change-Id: Iadcc9174f51d7f634cfec048df61a3df8379dc14
---
M pwb.py
1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/pwb.py b/pwb.py
index 8c6b31b..082e353 100755
--- a/pwb.py
+++ b/pwb.py
@@ -72,13 +72,11 @@
global pwb
try:
import pywikibot
- pwb = pywikibot
except RuntimeError:
remove_modules()
-
os.environ['PYWIKIBOT2_NO_USER_CONFIG'] = '2'
import pywikibot # noqa: E402
- pwb = pywikibot
+ pwb = pywikibot


def run_python_file(filename, argv, argvu, package=None):
@@ -151,17 +149,9 @@

try:
import requests
- if not hasattr(requests, '__version__'):
- print("requests import problem: requests.__version__ does not exist.")
- requests = None
except ImportError as e:
- print("ImportError: %s" % e)
- requests = None
-
-if not requests:
- raise ImportError("Python module 'requests' is required.\n"
- "Try running 'pip install requests'.")
-
+ raise ImportError("{0}\nPython module 'requests' is required.\n"
+ "Try running 'pip install requests'.".format(e))
del requests

if len(sys.argv) > 1 and sys.argv[1][0] != '-':

To view, visit change 420241. To unsubscribe, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Iadcc9174f51d7f634cfec048df61a3df8379dc14
Gerrit-Change-Number: 420241
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: Dalba <dalba.wiki@gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb@gmail.com>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444@gmail.com>
Gerrit-Reviewer: jenkins-bot <>