recipy.utils module*args, **kwargs)

Built-in open replacement that logs input and output

Workaround for issue #44. Patching __builtins__[‘open’] is complicated, because many libraries use standard open internally, while we only want to log inputs and outputs that are opened explicitly by the user.

The user can either use (only requires import recipy at the top of the script), or add from recipy import open and just use open.

If python 2 is used, and an encoding parameter is passed to this function, codecs is used to open the file with proper encoding.