file_access_utils

Attributes

logger

Functions

find_file_or_exit(arg_fn, argname)

Checks to see if a file given by a filename exists. If it doesn't,

find_directory_or_exit(arg_fn, argname)

Checks to see if a directory given by a filepath exists. If it doesn't,

Module Contents

logger[source]
find_file_or_exit(arg_fn, argname)[source]

Checks to see if a file given by a filename exists. If it doesn’t, this fails gracefully and exits to the command line.

Parameters:
  • arg_fn (string) – The filepath/name of the file to be checked.

  • argname (string) – The name of the argument being checked. Used for error message.

Returns:

arg_fn – The filepath/name of the file to be checked.

Return type:

string

find_directory_or_exit(arg_fn, argname)[source]

Checks to see if a directory given by a filepath exists. If it doesn’t, this fails gracefully and exits to the command line.

Parameters:
  • arg_fn (string) – The filepath of the directory to be checked.

  • argname (string) – The name of the argument being checked. Used for error message.

Returns:

arg_fn – The filepath of the directory to be checked.

Return type:

string