From 1f224a90c7a41191ca6292759ae44df8ee5d968c Mon Sep 17 00:00:00 2001 From: "Fabien C. Y. Benureau" Date: Mon, 17 Jul 2017 15:42:06 +0200 Subject: [PATCH] Fixes websearch in Python 3 (fix #69) --- pubs/commands/websearch_cmd.py | 4 ++-- pubs/p3.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pubs/commands/websearch_cmd.py b/pubs/commands/websearch_cmd.py index 7599f0d..2f2a172 100644 --- a/pubs/commands/websearch_cmd.py +++ b/pubs/commands/websearch_cmd.py @@ -1,6 +1,6 @@ import webbrowser -import urllib +from .. import p3 from ..uis import get_ui @@ -18,5 +18,5 @@ def command(conf, args): search_string = args.search_string url = ("https://scholar.google.fr/scholar?q=%s&lr=" - % (urllib.quote_plus(' '.join(search_string)))) + % (p3.quote_plus(' '.join(search_string)))) webbrowser.open(url) diff --git a/pubs/p3.py b/pubs/p3.py index 6bb4d14..93229d6 100644 --- a/pubs/p3.py +++ b/pubs/p3.py @@ -17,6 +17,7 @@ if sys.version_info[0] == 2: ustr = unicode uchr = unichr from urlparse import urlparse + from urllib import quote_plus from urllib2 import urlopen from httplib import HTTPConnection file = None @@ -30,7 +31,7 @@ if sys.version_info[0] == 2: else: ustr = str uchr = chr - from urllib.parse import urlparse + from urllib.parse import urlparse, quote_plus from urllib.request import urlopen from http.client import HTTPConnection