From 89e4d039bb9374293454f1e869a39cce42756e54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Lubiak?= Date: Wed, 22 Jun 2022 17:32:31 +0200 Subject: [PATCH] Upgraded autoinstallation of modules --- client.py | 8 ++++---- server.py | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/client.py b/client.py index 5997089..22444bc 100755 --- a/client.py +++ b/client.py @@ -1,12 +1,12 @@ from socket import socket, AF_INET, SOCK_STREAM from threading import Thread from time import sleep -from subprocess import run -from sys import argv +from subprocess import check_call +from sys import argv, executable try: from cryptography.fernet import Fernet except: - run("python3 -m pip install cryptography") + check_call((executable, '-m', 'pip', 'install', 'cryptography')) from cryptography.fernet import Fernet class client(): @@ -41,6 +41,6 @@ class client(): self.sMsg(msg) if __name__ == '__main__': - run("clear") + check_call('clear') Client = client() Client.chat() diff --git a/server.py b/server.py index fea3893..931f518 100755 --- a/server.py +++ b/server.py @@ -1,12 +1,12 @@ from socket import socket, AF_INET, SOCK_STREAM from threading import Thread from time import sleep -from subprocess import run +from subprocess import check_call from sys import argv try: from cryptography.fernet import Fernet except: - run("python3 -m pip install cryptography") + check_call((executable, '-m', 'pip', 'install', 'cryptography')) from cryptography.fernet import Fernet class Server: @@ -40,7 +40,7 @@ class Server: self.client.send(self.f.encrypt(msg.encode())) if __name__ == '__main__': - run("clear") + check_call('clear') Server_m = Server() Server_m.chat() Server_m.receiving.join()