Skip to content

Don´t leave filehandles open

I just stumbled upon this:

    def __write_configuration(self):
        path_to_config = os.path.join(self.managedFolder, self.configFile)
        f = open(path_to_config, "wb")
        pickle.dump(self.distribution, f)

See https://stackoverflow.com/questions/2404430/does-filehandle-get-closed-automatically-in-python-after-it-goes-out-of-scope

Edited by Ghost User