2021-01-21 14:00:58 +02:00
# -*- coding: utf-8 -*-
import os , sys
from colors import *
from functions import getConfig
2021-04-24 03:08:43 +03:00
from functions import appendLog
2021-01-21 14:00:58 +02:00
# Работает не очень стабильно при отсутствии интернета
# try:
# if getConfig("debug"):
# updatepip = os.system('"{}" -m pip install -U '.format(sys.executable) + '--upgrade pip')
# print(f"{RESET}[{BGREEN}OK{RESET}] Обновлён {YELLOW}PIP{RESET}.")
# else:
# updatepip = os.system('"{}" -m pip install -U '.format(sys.executable) + '--upgrade pip' + " -q --no-warn-script-location")
# print(f"{RESET}[{BGREEN}OK{RESET}] Обновлён {YELLOW}PIP{RESET}.")
# except:
# updatepip = os.system('"{}" -m pip install -U '.format(sys.executable) + '--upgrade pip' + " -q --no-warn-script-location")
# if updatepip != 0:
# sys.exit(f"{RESET}[{BRED}ERR{RESET}] Обновление {YELLOW}PIP {RESET}провалилось.")
#########################################################
libs = [ ]
###################################
try :
import easygui
except ModuleNotFoundError :
2021-04-24 03:08:43 +03:00
appendLog ( " No module easygui " )
2021-01-21 14:00:58 +02:00
libs . append ( " easygui " )
###################################
try :
import tkinter
except ModuleNotFoundError :
2021-04-24 03:08:43 +03:00
appendLog ( " No module tkinter " )
2021-01-21 14:00:58 +02:00
libs . append ( " tkinter " )
###################################
try :
import keyboard
except ModuleNotFoundError :
2021-04-24 03:08:43 +03:00
appendLog ( " No module keyboard " )
2021-01-21 14:00:58 +02:00
libs . append ( " keyboard " )
###################################
try :
import ast
except ModuleNotFoundError :
2021-04-24 03:08:43 +03:00
appendLog ( " No module ast " )
2021-01-21 14:00:58 +02:00
libs . append ( " ast " )
###################################
try :
import inputimeout
except ModuleNotFoundError :
2021-04-24 03:08:43 +03:00
appendLog ( " No module inputimeout " )
2021-01-21 14:00:58 +02:00
libs . append ( " inputimeout " )
###################################
try :
import telegram_send
except ModuleNotFoundError :
2021-04-24 03:08:43 +03:00
appendLog ( " No module telegram_send " )
2021-01-21 14:00:58 +02:00
libs . append ( " telegram_send " )
###################################
try :
import wget
except ModuleNotFoundError :
2021-04-24 03:08:43 +03:00
appendLog ( " No module wget " )
2021-01-21 14:00:58 +02:00
libs . append ( " wget " )
###################################
try :
import requests
except ModuleNotFoundError :
2021-04-24 03:08:43 +03:00
appendLog ( " No module requests " )
2021-01-21 14:00:58 +02:00
libs . append ( " requests " )
###################################
2021-04-07 23:57:02 +03:00
try :
import playsound
except ModuleNotFoundError :
2021-04-24 03:08:43 +03:00
appendLog ( " No module playsound " )
2021-04-07 23:57:02 +03:00
libs . append ( " playsound " )
###################################
2021-01-21 14:00:58 +02:00
try :
from zipfile import ZipFile
except ModuleNotFoundError :
2021-04-24 03:08:43 +03:00
appendLog ( " No module zipfile " )
2021-01-21 14:00:58 +02:00
libs . append ( " zipfile " )
###################################
try :
import asyncio
except ModuleNotFoundError :
2021-04-24 03:08:43 +03:00
appendLog ( " No module asyncio " )
2021-01-21 14:00:58 +02:00
libs . append ( " asyncio " )
###################################
2021-04-24 03:08:43 +03:00
try :
import getpass
except ModuleNotFoundError :
appendLog ( " No module getpass " )
libs . append ( " getpass " )
###################################
2021-01-21 14:00:58 +02:00
try :
from pypresence import Presence
except ModuleNotFoundError :
2021-04-24 03:08:43 +03:00
appendLog ( " No module pypresence " )
2021-01-21 14:00:58 +02:00
libs . append ( " pypresence " )
###################################
if len ( libs ) > 0 :
2021-04-24 03:08:43 +03:00
print ( " Н е хватает нужных модулей, пробуем установить...\n Это может занять некоторое время. Пожалуйста, не закрывайте программу. " )
appendLog ( ' Missing some modules, trying to install them ' )
2021-01-21 14:00:58 +02:00
for each in libs :
try :
if getConfig ( " debug " ) :
response = os . system ( ' " {} " -m pip install -U ' . format ( sys . executable ) + each )
else :
response = os . system ( ' " {} " -m pip install -U ' . format ( sys . executable ) + each + " -q --no-warn-script-location " )
except :
response = os . system ( ' " {} " -m pip install -U ' . format ( sys . executable ) + each + " -q --no-warn-script-location " )
print ( f " { RESET } [ { BGREEN } OK { RESET } ] Установлен модуль { YELLOW } { each } { RESET } . " )
2021-04-24 03:08:43 +03:00
appendLog ( f ' Module { each } installed ' )
2021-01-21 14:00:58 +02:00
if response != 0 :
2021-04-24 03:08:43 +03:00
appendLog ( f ' Failed to install { each } ' )
2021-01-21 14:00:58 +02:00
sys . exit ( f " { RESET } [ { BRED } ERR { RESET } ] Установка { YELLOW } { each } { RESET } провалилась. " )
2021-04-24 03:08:43 +03:00
appendLog ( ' Everything seems to be installed ' )
2021-01-21 14:00:58 +02:00
print ( f " { RESET } [ { BGREEN } OK { RESET } ] В с е модули были успешно установлены. " )
try :
import easygui
import tkinter
import keyboard
import ast
import inputimeout
import telegram_send
import wget
import requests
2021-04-07 23:57:02 +03:00
import playsound
2021-01-21 14:00:58 +02:00
import asyncio
2021-04-24 03:08:43 +03:00
import getpass
2021-01-21 14:00:58 +02:00
from zipfile import ZipFile
from pypresence import Presence
except ModuleNotFoundError :
sys . exit ( f " \n ############################################################################# \n { BGREEN } Пожалуйста, перезапустите программу для продолжения! { RESET } \n Если это сообщение видно не впервые - напишите { BRED } @profitroll { RESET } в { CYAN } Telegram { RESET } или \n включите { BRED } debug { RESET } в { BRED } files/config.json { RESET } и решите проблему самостоятельно. \n ############################################################################# " )
#########################################################