open_file#
- ansys.aedt.core.generic.file_utils.open_file(file_path: str | Path, file_options: str = 'r', encoding: str = None, override_existing: bool = True) TextIO | None #
Open a file and return the object.
- Parameters:
- file_path
str
orpathlib.Path
Full absolute path to the file (either local or remote).
- file_options
str
,optional
Options for opening the file.
- encoding
str
,optional
Name of the encoding used to decode or encode the file. The default is
None
, which means a platform-dependent encoding is used. You can specify any encoding supported by Python.- override_existingbool,
optional
Whether to override an existing file if opening a file in write mode on a remote machine. The default is
True
.
- file_path
- Returns:
Union
[TextIO
,None
]Opened file object or
None
if the file or folder does not exist.