stouputils.io package#

This module provides utilities for file management.

  • json_dump(): Writes the provided data to a JSON file with a specified indentation depth.

  • json_load(): Load a JSON file from the given path

  • csv_dump(): Writes data to a CSV file with customizable options

  • csv_load(): Load a CSV file from the given path

  • get_root_path(): Get the absolute path of the directory

  • relative_path(): Get the relative path of a file relative to a given directory

  • super_copy(): Copy a file (or a folder) from the source to the destination (always create the directory)

  • super_open(): Open a file with the given mode, creating the directory if it doesn’t exist (only if writing)

  • replace_tilde(): Replace the “~” by the user’s home directory

  • clean_path(): Clean the path by replacing backslashes with forward slashes and simplifying the path

  • copytree_with_progress(): Copy a directory tree with a colored progress bar

  • redirect_folder(): Move a folder and create a junction/symlink at the original location

  • safe_close(): Safely close a file descriptor or file object after flushing, ignoring any exceptions

stouputils io examples

Submodules#