diff --git a/easycloud/core/easycloud.py b/easycloud/core/easycloud.py index 273169e0f645c59aa9bc5606ab943f5733f882db..fe61781cdcaa2b81f2914bf89a3863e00700293c 100755 --- a/easycloud/core/easycloud.py +++ b/easycloud/core/easycloud.py @@ -6,7 +6,7 @@ from easycloud.core.module import Module import easycloud.modules from easycloud.tui.simpletui import SimpleTUI import logging -from os import environ, sep +from os from pkgutil import iter_modules import subprocess import sys @@ -69,11 +69,11 @@ class EasyCloud: disclaimer = "\033[34;1mThis is a proof-of-concept build, not suitable\nfor production use.\033[0m\n" debug_status = None hffr_status = None - if "LIBCLOUD_DEBUG" in environ: + if "LIBCLOUD_DEBUG" in os.environ: debug_status = "\033[93mLibcloud Debug Mode ON\033[0m" else: debug_status = "\033[90mLibcloud Debug Mode OFF\033[0m" - if "LIBCLOUD_DEBUG_PRETTY_PRINT_RESPONSE" in environ and environ["LIBCLOUD_DEBUG_PRETTY_PRINT_RESPONSE"] == "1": + if "LIBCLOUD_DEBUG_PRETTY_PRINT_RESPONSE" in os.environ and os.environ["LIBCLOUD_DEBUG_PRETTY_PRINT_RESPONSE"] == "1": hffr_status = "\033[93mLibcloud Human friendly formatted response ON\033[0m" else: hffr_status = "\033[90mLibcloud Human friendly formatted response OFF\033[0m" @@ -193,7 +193,7 @@ class EasyCloud: else: SimpleTUI.msg_dialog("Library installer", "There was an error while installing the missing packages\n" + "for " + module.platform_name + ".\n" - "Please check " + os.pardir + os.sep + "logs" + sep + "installer.log in the main directory for details.", SimpleTUI.DIALOG_ERROR) + "Please check " + os.pardir + os.sep + "logs" + os.sep + "installer.log in the main directory for details.", SimpleTUI.DIALOG_ERROR) return False return False return True @@ -211,13 +211,13 @@ class EasyCloud: """ subproc = subprocess.Popen([sys.executable, "-m", "pip", "install", "--user"] + pip_libs, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) try: - logfile = open(os.pardir + os.sep + "logs" + sep + "libs_installer.log", "a+") # open log in append mode + logfile = open(os.pardir + os.sep + "logs" + os.sep + "libs_installer.log", "a+") # open log in append mode for line in subproc.stdout: # write the subprocess stdout to the log file logfile.write(line.decode(sys.stdout.encoding)) logfile.close() except IOError as e: - logging.error("IO Error while trying to write data on " + os.pardir + os.sep + "logs" + sep + "libs_installer.log: " + str(e)) + logging.error("IO Error while trying to write data on " + os.pardir + os.sep + "logs" + os.sep + "libs_installer.log: " + str(e)) subproc.wait() if subproc.returncode: # raise an exception if the installation encountered a problem return False