def exit_shell(self, argument_list): """ Exit shell Input: - argument_list: Arguments interepred from user input Output: - A print message indicate whether the function runs smoothly or has any error. """ print("exit") try: exit_code = int(argument_list[1]) except ValueError: print("intek-sh: exit: numeric argument required") system_exit(2) except IndexError: system_exit(0) if len(argument_list) > 2: print("intek-sh: exit: Too many arguments") system_exit(exit_code % 256)
os_rename(file_path,new_file_path) except OSError as e: print '%s%s %s' % (e,', cannot rename', file_path) return False return True ## Start main portion of the script if __name__ == '__main__': ## If we cannot validate version of the OS, we bail if validate_os('ubuntu') == False: try: raise Exception('Unknown Operating System', 1) except Exception as e: print '%s %s %s %d' % ('Exception Raised:', e[0], 'Return Code:',e[1]) system_exit(e[1]) ## Imports in the '__main__' section of the program import argparse import string import time cmdline_args = system_argv[1:] ## Define our main parser and add all required arguments ## gateway is the only optional argument with this script parser = argparse.ArgumentParser(version='1.1', description='''Network Interface Persistent Configuration Generator Tool''', prog=system_argv[0], usage='%(prog)s -i <Interface Name> -a <IP Address> -m <Subnet Mask> [-g <Gateway Address>]' )
from os.path import ismount as is_path_mount from sys import argv as arguments from sys import exit as system_exit import RPi.GPIO as PinIO import time as Time # Default configuration cycles_per_photo = 5 stepper_wait = 0.010 photo_wait = 5 # Check arguments if len(arguments) != 2: print 'Incorrect agrument count. Must include location.' system_exit(0) # Make sure a drive is mounted external_USB = arguments[1] if not is_path_mount(external_USB): print 'Location is not a mounted drive.' system_exit(0) # Make sure saving folder exists frames_dir = external_USB + '/frames' if (not path_exists(frames_dir)): make_dir(frames_dir, 0777) # Use BCM GPIO references instead of physical pin numbers PinIO.setwarnings(False) PinIO.setmode(PinIO.BCM)
def main(): application = LslProcessor(argument_vector[1:]) exit_code = application.run() system_exit(exit_code)
print '%s%s %s' % (e, ', cannot rename', file_path) return False return True ## Start main portion of the script if __name__ == '__main__': ## If we cannot validate version of the OS, we bail if validate_os('ubuntu') == False: try: raise Exception('Unknown Operating System', 1) except Exception as e: print '%s %s %s %d' % ('Exception Raised:', e[0], 'Return Code:', e[1]) system_exit(e[1]) ## Imports in the '__main__' section of the program import argparse import string import time cmdline_args = system_argv[1:] ## Define our main parser and add all required arguments ## gateway is the only optional argument with this script parser = argparse.ArgumentParser( version='1.1', description='''Network Interface Persistent Configuration Generator Tool''', prog=system_argv[0], usage=