gopen#

gwpy.io.utils.gopen(name, *args, **kwargs)[source]#

Open a file handling optional gzipping.

Deprecated since version 4.0.0: This function is deprecated and will be removed in a future release.

If name ends with '.gz', or if the GZIP file signature is found at the beginning of the file, the file will be opened with gzip.open, otherwise a regular file will be returned from open.

Parameters:
namestr, pathlib.Path

path or name of file to open.

*args, **kwargs

other arguments to pass to either open for regular files, or gzip.open for gzipped files.

Returns:
fileio.TextIoBase, file, gzip.GzipFile

the open file object