contrib: import 'requests' in try-except
This commit is contained in:
parent
78f5afff74
commit
8b775fd24a
@ -1,7 +1,10 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import requests
|
try:
|
||||||
|
import requests
|
||||||
|
except ImportError as e:
|
||||||
|
sys.exit(f"Error: {str(e)}. Try 'sudo python3 -m pip install <module-name>'")
|
||||||
|
|
||||||
|
|
||||||
def check_restriction(p, r):
|
def check_restriction(p, r):
|
||||||
|
|||||||
@ -3,7 +3,12 @@ import os
|
|||||||
import subprocess
|
import subprocess
|
||||||
import io
|
import io
|
||||||
import zipfile
|
import zipfile
|
||||||
import requests
|
import sys
|
||||||
|
|
||||||
|
try:
|
||||||
|
import requests
|
||||||
|
except ImportError as e:
|
||||||
|
sys.exit(f"Error: {str(e)}. Try 'sudo python3 -m pip install <module-name>'")
|
||||||
|
|
||||||
os.chdir(os.path.dirname(os.path.realpath(__file__)))
|
os.chdir(os.path.dirname(os.path.realpath(__file__)))
|
||||||
os.chdir('..')
|
os.chdir('..')
|
||||||
|
|||||||
@ -790,7 +790,7 @@ class ElectrumWindow(App):
|
|||||||
notification.notify('Electrum', message,
|
notification.notify('Electrum', message,
|
||||||
app_icon=icon, app_name='Electrum')
|
app_icon=icon, app_name='Electrum')
|
||||||
except ImportError:
|
except ImportError:
|
||||||
Logger.Error('Notification: needs plyer; `sudo pip install plyer`')
|
Logger.Error('Notification: needs plyer; `sudo python3 -m pip install plyer`')
|
||||||
|
|
||||||
def on_pause(self):
|
def on_pause(self):
|
||||||
self.pause_time = time.time()
|
self.pause_time = time.time()
|
||||||
|
|||||||
@ -29,7 +29,7 @@ from . import FAST_TESTS
|
|||||||
try:
|
try:
|
||||||
import ecdsa
|
import ecdsa
|
||||||
except ImportError:
|
except ImportError:
|
||||||
sys.exit("Error: python-ecdsa does not seem to be installed. Try 'sudo pip install ecdsa'")
|
sys.exit("Error: python-ecdsa does not seem to be installed. Try 'sudo python3 -m pip install ecdsa'")
|
||||||
|
|
||||||
|
|
||||||
def needs_test_with_all_ecc_implementations(func):
|
def needs_test_with_all_ecc_implementations(func):
|
||||||
|
|||||||
@ -50,7 +50,7 @@ def check_imports():
|
|||||||
import jsonrpclib
|
import jsonrpclib
|
||||||
import aiorpcx
|
import aiorpcx
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
sys.exit("Error: %s. Try 'sudo pip install <module-name>'"%str(e))
|
sys.exit(f"Error: {str(e)}. Try 'sudo python3 -m pip install <module-name>'")
|
||||||
# the following imports are for pyinstaller
|
# the following imports are for pyinstaller
|
||||||
from google.protobuf import descriptor
|
from google.protobuf import descriptor
|
||||||
from google.protobuf import message
|
from google.protobuf import message
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user