Esempio n. 1
0
  private void open() {
    log("Opening Python process in interactive mode.");
    openProcess();

    log("Reading Python preamble");
    String preamble = readPreamble(timeoutMs);

    if (!preamble.startsWith("Python 2.7"))
      warn(
          "Python 2.7 was not detected in python interpreter preamble. "
              + "There may be version issues. Preamble:\n"
              + preamble);

    log("Python process opened successfully. Preamble: \n" + preamble);

    // remove the continuation prompt on multi-line commands in interactive mode "... "
    send("import sys");
    send("sys.ps2 = ''");

    for (String pack : REQUIRED_PACKAGES) {
      try {
        send("import " + pack);
      } catch (AutomatonExportException e) {
        error("Python import failed on required package '" + pack + "'");
      }
    }

    // test hypy
    try {
      send("import hybridpy.hypy as hypy");
    } catch (AutomatonExportException e) {
      error(
          "Python import failed on required package 'hybridpy.hypy'. "
              + "Is Hyst's hybridpy directory on your PYTHONPATH?");
    }
  }
Esempio n. 2
0
 /**
  * Sets the timeout in milliseconds, use NO_TIMEOUT for no timeout
  *
  * @param timeoutMs
  */
 public void setTimeout(int timeoutMs) {
   log("setTimeout(" + timeoutMs + ") called");
   this.timeoutMs = timeoutMs;
 }