MPF.IOHelpers module

class MPF.IOHelpers.Capturing[source]

Bases: list

context manager to capture stdout of the encapsulated command(s). Might be useful to get some Information that ROOT won’t give us, but print. See http://stackoverflow.com/questions/16571150/how-to-capture-stdout-output-from-a-python-function-call#16571630 NOT WORKING YET SINCE IT DOESN’T CAPTURE OUTPUT FROM C++ CALLS

class MPF.IOHelpers.ROpen(fileName, mode='READ')[source]

Bases: object

context manager to open root files

class MPF.IOHelpers.cd(newPath)[source]

Context manager for changing the current working directory

class MPF.IOHelpers.workInTempDir(baseDir=None, skipCleanup=False, prefix='tmp_', cleanAtExit=False)[source]

Context manager for changing to a temporary directory that will be deleted afterwards. The given dir will be the base directory in which the tempdir is created. If not given, the system tmp directory will be used. If skipCleanup is given the directory is not deleted afterwards. Use prefix to control the naming format. If cleanAtExit is set the tmp directory is cleaned at exit of the script, not when exiting the context.

cleanup()[source]