protected String getInterpreterPath() throws ExecutionException {
   String interpreterPath = myConfig.getInterpreterPath();
   if (interpreterPath == null) {
     throw new ExecutionException("Cannot find Python interpreter for this run configuration");
   }
   return interpreterPath;
 }
  /**
   * Patches the command line parameters applying patchers from first to last, and then runs it.
   *
   * @param patchers any number of patchers; any patcher may be null, and the whole argument may be
   *     null.
   * @return handler of the started process
   * @throws ExecutionException
   */
  protected ProcessHandler startProcess(CommandLinePatcher... patchers) throws ExecutionException {
    GeneralCommandLine commandLine = generateCommandLine(patchers);

    // Extend command line
    PythonRunConfigurationExtensionsManager.getInstance()
        .patchCommandLine(
            myConfig, getRunnerSettings(), commandLine, getEnvironment().getRunner().getRunnerId());
    Sdk sdk = PythonSdkType.findSdkByPath(myConfig.getInterpreterPath());
    final ProcessHandler processHandler;
    if (PySdkUtil.isRemote(sdk)) {
      PyRemotePathMapper pathMapper = createRemotePathMapper();
      processHandler =
          createRemoteProcessStarter()
              .startRemoteProcess(sdk, commandLine, myConfig.getProject(), pathMapper);
    } else {
      EncodingEnvironmentUtil.setLocaleEnvironmentIfMac(commandLine);
      processHandler = doCreateProcess(commandLine);
      ProcessTerminatedListener.attach(processHandler);
    }

    // attach extensions
    PythonRunConfigurationExtensionsManager.getInstance()
        .attachExtensionsToProcess(myConfig, processHandler, getRunnerSettings());

    return processHandler;
  }
 private TextConsoleBuilder createConsoleBuilder(Project project) {
   if (isDebug()) {
     return new PyDebugConsoleBuilder(
         project, PythonSdkType.findSdkByPath(myConfig.getInterpreterPath()));
   } else {
     return TextConsoleBuilderFactory.getInstance().createBuilder(project);
   }
 }
 @Nullable
 public PythonSdkFlavor getSdkFlavor() {
   return PythonSdkFlavor.getFlavor(myConfig.getInterpreterPath());
 }