def main(launch: bool = True): try: import settings enable_sentry: bool = settings.get('sentry_level') != 'Never' except Exception: enable_sentry = True # will almost certainly crash later anyway if this happens try: if enable_sentry: # set up Sentry (https://sentry.io/) sentry_sdk.init(dsn=utils.get_api_key('sentry'), release=VERSION, attach_stacktrace=True, max_breadcrumbs=50, debug=DEBUG, environment="Debug build" if DEBUG else "Release", request_bodies='small') with sentry_sdk.configure_scope() as scope: user_pc_name: str = socket.gethostname() try: user_identifier: str = getpass.getuser() except ModuleNotFoundError: user_identifier = user_pc_name scope.user = {'username': f'{user_pc_name}_{user_identifier}'} import main if launch: main.launch() except SystemExit: raise except Exception: handle_crash()
def performLaunch(): launched = True try: import main main.launch() except Exception as e: print('fail launch: ' + str(e)) print(traceback.format_exc())
def test_launch_test_app(self): e_wrapper_called = Event() def e_wrapper(cb): e_wrapper_called.set() with patch.object(main_py, 'exception_wrapper', side_effect=e_wrapper): #with patch.object(main_py, 'exception_wrapper', side_effect = e_wrapper): main_py.launch(name="apps/example_apps/test/") assert (e_wrapper_called.isSet())
import shutil import os import glob """def recursive_copy_files(source_path, destination_path, override=True): files_count = 0 if not os.path.exists(destination_path): os.mkdir(destination_path) print('Creating destination directory') items = glob.glob(source_path + '/*') for item in items: if os.path.isdir(item): path = os.path.join(destination_path, item.split('/')[-1]) files_count += recursive_copy_files(source_path=item, destination_path=path, override=override) else: file = os.path.join(destination_path, item.split('/')[-1]) if not os.path.exists(file) or override: shutil.copyfile(item, file) files_count += 1 return files_count if not (main.VER == DataBaseConnection().GetVersion()): print(recursive_copy_files('C:\\Users\\renan.klehm\\Desktop\\backup', 'C:\\Users\\renan.klehm\\Desktop\\WM-Lages')) main.launch() else: main.launch()""" main.launch()
def desktop(param_path=False): if param_path: main.main(param_path) else: main.launch()
def autostart(): # Processes to start during boot: for p in ["keyboard", "terminal", "firefox"]: launch(program(p))
import psyco import main psyco.profile() main.launch()
def first_launch(): import grpc_generator grpc_generator.main() import main main.launch()