aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2021-02-23 11:43:22 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2021-02-23 11:43:22 +0000
commit5984277fe361a5372e0ce8061ddf28bffd233877 (patch)
treeca7f3e3db283da715cf1276129c3a30ac9b8f3a2 /utils
parentMerge pull request #7381 (diff)
downloadmonero-5984277fe361a5372e0ce8061ddf28bffd233877.tar.xz
python-rpc: adapt urlparse for python3
Diffstat (limited to 'utils')
-rwxr-xr-xutils/python-rpc/console.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/utils/python-rpc/console.py b/utils/python-rpc/console.py
index c94e07eab..4b3c18f5d 100755
--- a/utils/python-rpc/console.py
+++ b/utils/python-rpc/console.py
@@ -4,7 +4,16 @@ from __future__ import print_function
import sys
import subprocess
import socket
-import urlparse
+try:
+ import urllib.parse
+ url_parser = urllib.parse.urlparse
+except:
+ try:
+ import urlparse
+ url_parser = urlparse.urlparse
+ except:
+ print('urllib or urlparse is needed')
+ sys.exit(1)
import framework.rpc
import framework.daemon
import framework.wallet
@@ -21,7 +30,7 @@ for n in range(1, len(sys.argv)):
try:
port = int(sys.argv[n])
except:
- t = urlparse.urlparse(sys.argv[n], allow_fragments = False)
+ t = url_parser(sys.argv[n], allow_fragments = False)
scheme = t.scheme or scheme
host = t.hostname or host
port = t.port or port