diff --git a/.bin/Scripts/functions/activation.py b/.bin/Scripts/functions/activation.py index 3eea560c..305d9559 100644 --- a/.bin/Scripts/functions/activation.py +++ b/.bin/Scripts/functions/activation.py @@ -4,10 +4,9 @@ import subprocess from borrowed import acpi from functions.common import * -from os import environ # Variables -SLMGR = r'{}\System32\slmgr.vbs'.format(environ.get('SYSTEMROOT')) +SLMGR = r'{}\System32\slmgr.vbs'.format(global_vars['Env']['SYSTEMROOT']) def activate_with_bios(): """Attempt to activate Windows with a key stored in the BIOS.""" diff --git a/.bin/Scripts/functions/common.py b/.bin/Scripts/functions/common.py index fc4ed20e..ad4a3c49 100644 --- a/.bin/Scripts/functions/common.py +++ b/.bin/Scripts/functions/common.py @@ -52,7 +52,7 @@ class NotInstalledError(Exception): class NoProfilesError(Exception): pass -class PathNotFoundException(Exception): +class PathNotFoundError(Exception): pass class UnsupportedOSError(Exception): @@ -174,7 +174,7 @@ def human_readable_size(size, decimals=0): size = convert_to_bytes(size) # Verify we have a valid size - if size <= 0: + if size < 0: return '{size:>{width}} b'.format(size='???', width=width) # Convert to sensible units @@ -432,7 +432,7 @@ def try_and_print(message='Trying...', err = traceback.format_exc() # Return or raise? - if bool(err) and not catch_all: + if err and not catch_all: raise else: return {'CS': not bool(err), 'Error': err} diff --git a/.bin/Scripts/functions/data.py b/.bin/Scripts/functions/data.py index 47714b9d..12d568b7 100644 --- a/.bin/Scripts/functions/data.py +++ b/.bin/Scripts/functions/data.py @@ -374,7 +374,7 @@ def scan_source_wim(source_wim, dest_path, rel_path=None, interactive=True): def select_destination(folder_path, prompt='Select destination'): """Select destination drive, returns path as string.""" - disk = select_disk(prompt) + disk = select_volume(prompt) if 'fixed' not in disk['Disk'].opts: folder_path = folder_path.replace('\\', '-') path = '{disk}{folder_path}_{Date}'.format( @@ -388,7 +388,7 @@ def select_destination(folder_path, prompt='Select destination'): return path -def select_disk(title='Select disk', auto_select=True): +def select_volume(title='Select disk', auto_select=True): """Select disk from attached disks. returns dict.""" actions = [{'Name': 'Quit', 'Letter': 'Q'}] disks = [] diff --git a/.bin/Scripts/functions/info.py b/.bin/Scripts/functions/info.py index 5ce703f3..38f1f7c5 100644 --- a/.bin/Scripts/functions/info.py +++ b/.bin/Scripts/functions/info.py @@ -146,7 +146,7 @@ def get_shell_path(folder, user='current'): if folderid: try: path = knownpaths.get_path(folderid, getattr(knownpaths.UserHandle, user)) - except PathNotFoundException: + except PathNotFoundError: # Folder not found, ignore and return None pass