WriteFile

vtool.util_file.WriteFile(filepath)
class WriteFile(filepath)
write_file()

Write file. Basically creates the file if it doesn’t exist. If set_append is True than append any lines to the file instead of replacing.

set_append(bool_value)

Append new lines to end of document instead of replace.

Parameters:bool_value (bool) –
write_line(line)

Write a single line to the file.

Parameters:line (str) – The line to add to the file.
write(lines, last_line_empty=True)

Write the lines to the file.

Parameters:
  • lines (list) – A list of lines. Each entry is a new line in the file.
  • last_line_empty (bool) – Wether or not to add a line after the last line.
append_file()

Start append file.

close_file()

Close file.

get_open_file()

Get open file object.

read_file()

Start read the file.

warning_if_invalid_file(warning_text)

Check if file is invalid and raise and error.

warning_if_invalid_folder(warning_text)

Check if folder is invalid and raise and error.

warning_if_invlid_path(warning_text)

Check if path to file is invalid and raise error.