Don't use sys.exit(), re-raise ImportError instead
This commit is contained in:
parent
ae21ada0f4
commit
42a2878842
@ -18,17 +18,18 @@
|
||||
|
||||
import logging
|
||||
import socket
|
||||
import sys
|
||||
from collections import namedtuple
|
||||
|
||||
try:
|
||||
import socks
|
||||
except ImportError:
|
||||
sys.exit(
|
||||
except ImportError as e:
|
||||
e.msg = (
|
||||
"PySocks is missing and Pyrogram can't run without. "
|
||||
"Please install it using \"pip3 install pysocks\"."
|
||||
)
|
||||
|
||||
raise e
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
Proxy = namedtuple("Proxy", ["enabled", "hostname", "port", "username", "password"])
|
||||
|
@ -16,19 +16,18 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import sys
|
||||
|
||||
try:
|
||||
import tgcrypto
|
||||
except ImportError:
|
||||
sys.exit(
|
||||
except ImportError as e:
|
||||
e.msg = (
|
||||
"TgCrypto is missing and Pyrogram can't run without. "
|
||||
"Please install it using \"pip3 install tgcrypto\". "
|
||||
"More info: https://docs.pyrogram.ml/resources/TgCrypto"
|
||||
)
|
||||
|
||||
raise e
|
||||
|
||||
|
||||
# TODO: Ugly IFs
|
||||
class AES:
|
||||
@classmethod
|
||||
def ige_encrypt(cls, data: bytes, key: bytes, iv: bytes) -> bytes:
|
||||
|
Loading…
Reference in New Issue
Block a user