I want to ensure that all resources are being cleaned correctly. Is this a safe thing to do:
try:
closing(open(okFilePath, "w"))
except Exception, exception:
logger.error(exception)
raise
EDIT:
Infact, thinking about it, do I even need the try/catch as I am raising the exception anyways I can log at a higher level. If it errors on creating the file, one can assume there is nothing to close?
open(okFilePath, 'w+').close()?openraises an exception, it won't be closed.with open(path, 'w+'): passcan technically be expressed on a single line though, and that will handle exceptions.'x'mode for creating a file or failing if it exists already/cannot be created.