schmir / bbfreeze

UNMAINTAINED
http://pypi.python.org/pypi/bbfreeze/
92 stars 22 forks source link

Redirect stdout/stderr to files #11

Closed dandrzejewski closed 12 years ago

dandrzejewski commented 12 years ago

It would be nice to redirect stdout/stderr to files (in the case of gui_only = True). This can be done in code, so it's not a high priority, but it would be a nice to have.

CONSOLE_LOG = "log/console.log"

if os.path.exists(CONSOLE_LOG) and os.path.isfile(CONSOLE_LOG):
        utils.rolloverLog(CONSOLE_LOG)

    stdoutfile = open(CONSOLE_LOG, "a")

    sys.stdout = utils.Unbuffered(stdoutfile)

    sys.stderr = sys.stdout
schmir commented 12 years ago

python itself doesn't do that. I think each program should handle that if it needs it.