# knitout_interpreter.run_knitout module

A Module containing the run_knitout function for running a knitout file through the knitout interpreter.

knitout_interpreter.run_knitout.run_knitout(knitout_file_name)

  Execute knitout instructions from a given file.

  This function provides a convenient interface for processing a knitout file through the knitout interpreter, returning the executed instructions and resulting machine state and knit graph.

  Parameters:

    knitout_file_name (str) – Path to the file that contains knitout instructions.

  Returns:

    A 3-element tuple containing the executed instructions, final machine state, and knit graph. The first element is a list of Knitout_Line objects representing all processed instructions. The second element is a Knitting_Machine object containing the final state of the virtual knitting machine after execution. The third element is a Knit_Graph object representing the resulting fabric structure formed by the knitting operations.

  Return type:

    tuple

  Example

  Basic usage:

      instructions, machine, graph = run_knitout("pattern.k")
      print(f"Executed {len(instructions)} instructions")
      print(f"Machine has {len(machine.needle_beds)} needle beds")
      print(f"Graph contains {graph.node_count} nodes")

  Note

  The knitout file must be a valid knitout format file with proper headers and instructions.

  Raises:

    - FileNotFoundError – If the specified knitout file cannot be found.

    - ValueError – If the knitout file contains invalid syntax or instructions.