      raise Exception("This program requires at least python3.2")
  if sys.version_info[0] == 3 and sys.version_info[1] < 2:
      raise Exception("This program requires at least python3.2")
  
  from lib.cli import FullHelpArgumentParser
  
  from scripts.extract import ExtractTrainingData
  from scripts.train import TrainingProcessor
  from scripts.convert import ConvertImage
  from scripts.gui import TKGui
  
  def bad_args(args):
      parser.print_help()
      exit(0)
  
 
</s> remove     parser.print_help()
 </s> add     """ Print help on bad arguments """
    PARSER.print_help() </s> remove # DLIB is a GPU Memory hog, so the following modules should only be imported when required
detect_faces = None
DetectedFace = None
FaceFilter = None

def import_faces_detect():
    ''' Import the faces_detect module only when it is required '''
    global detect_faces
    global DetectedFace
    if detect_faces is None or DetectedFace is None:
        import lib.faces_detect 
        detect_faces = lib.faces_detect.detect_faces
        DetectedFace = lib.faces_detect.DetectedFace
 </s> add from plugins.PluginLoader import PluginLoader

class ScriptExecutor(object):
    """ Loads the relevant script modules and executes the script.
        This class is initialised in each of the argparsers for the relevant command,
        then execute script is called within their set_default function """

    def __init__(self, command, subparsers=None):
        self.command = command.lower()
        self.subparsers = subparsers

    def import_script(self):
        """ Only import a script's modules when running that script."""
        if self.command == 'extract':
            from scripts.extract import Extract as script
        elif self.command == 'train':
            from scripts.train import Train as script
        elif self.command == 'convert':
            from scripts.convert import Convert as script
        elif self.command == 'gui':
            from scripts.gui import Gui as script
        else:
            script = None
        return script </s> remove from lib.cli import DirectoryProcessor, FullPaths
from lib.utils import BackgroundGenerator, get_folder, get_image_paths, rotate_image
 </s> add from scripts.fsmedia import Alignments, Images, Faces, Utils
from scripts.extract import Extract
from lib.utils import BackgroundGenerator, get_folder, get_image_paths </s> remove import threading 
from lib.utils import get_image_paths, get_folder
from lib.cli import FullPaths, argparse, os, sys
from plugins.PluginLoader import PluginLoader
 </s> add import os
import sys
import threading
      raise Exception("This program requires at least python3.2")
  if sys.version_info[0] == 3 and sys.version_info[1] < 2:
      raise Exception("This program requires at least python3.2")
  






  
  def bad_args(args):
      parser.print_help()
      exit(0)
  
keep keep keep keep replace replace replace replace replace replace keep keep keep keep keep
 cli/scripts Refactor (#367)

* Refactor for PEP 8 and split process function

* Remove backwards compatibility for skip frames

* Split optional functions into own class. Make functions more modular

* Conform scripts folder to PEP 8

* train.py - Fix write image bug. Make more modular

* extract.py - Make more modular, Put optional actions into own class

* cli.py - start PEP 8

* cli,py - Pep 8. Refactor and make modular. Bugfixes

* 1st round refactor. Completely untested and probably broken.

* convert.py: Extract alignments from frames if they don't exist

* BugFix: SkipExisting broken since face name refactor

* Extract.py tested

* Minor formatting

* convert.py + train.py amended not tested

* train.py - Semi-fix for hang on reaching target iteration. Now quits on preview mode
Make tensorflow / system warning less verbose

* 2nd pass refactor. Semi tested

bugfixes

* Remove obsolete code. imread/write to Utils

* rename inout.py to fsmedia.py

* Final bugfixes 
faceswap.py