parameters: (options)
docstring: Main entry point for the application
docstring_summary: Main entry point for the application
docstring_tokens: Main entry point for the application
function: def start(options):
      """Main entry point for the application"""
      # Set the global figure manager in matplotlib. Very important this happens first.
      from workbench.plotting.config import init_mpl_gcf
      init_mpl_gcf()
  
      # cleanup static resources at exit
      atexit.register(qCleanupResources)
  
      # fix/validate arguments
      if options.script is not None:
          # convert into absolute path
          options.script = os.path.abspath(os.path.expanduser(options.script))
          if not os.path.exists(options.script):
              print('script "{}" does not exist'.format(options.script))
              options.script = None
  
      app = initialize()
      # the default sys check interval leads to long lags
      # when request scripts to be aborted
      setswitchinterval(SYSCHECK_INTERVAL)
      exit_value = 0
      try:
          exit_value = start_workbench(app, options)
      except BaseException:
          # We count this as a crash
          import traceback
          # This is type of thing we want to capture and have reports
          # about. Prints to stderr as we can't really count on anything
          # else
          traceback.print_exc(file=ORIGINAL_STDERR)
          try:
              print_file_path = os.path.join(ConfigService.getAppDataDirectory(), STACKTRACE_FILE)
              with open(print_file_path, 'w') as print_file:
                  traceback.print_exc(file=print_file)
          except OSError:
              pass
          exit_value = -1
      finally:
          ORIGINAL_SYS_EXIT(exit_value)
function_tokens: def start ( options ) : # Set the global figure manager in matplotlib. Very important this happens first. from workbench . plotting . config import init_mpl_gcf init_mpl_gcf ( ) # cleanup static resources at exit atexit . register ( qCleanupResources ) # fix/validate arguments if options . script is not None : # convert into absolute path options . script = os . path . abspath ( os . path . expanduser ( options . script ) ) if not os . path . exists ( options . script ) : print ( 'script "{}" does not exist' . format ( options . script ) ) options . script = None app = initialize ( ) # the default sys check interval leads to long lags # when request scripts to be aborted setswitchinterval ( SYSCHECK_INTERVAL ) exit_value = 0 try : exit_value = start_workbench ( app , options ) except BaseException : # We count this as a crash import traceback # This is type of thing we want to capture and have reports # about. Prints to stderr as we can't really count on anything # else traceback . print_exc ( file = ORIGINAL_STDERR ) try : print_file_path = os . path . join ( ConfigService . getAppDataDirectory ( ) , STACKTRACE_FILE ) with open ( print_file_path , 'w' ) as print_file : traceback . print_exc ( file = print_file ) except OSError : pass exit_value = - 1 finally : ORIGINAL_SYS_EXIT ( exit_value )