Ask Your Question

Revision history [back]

Telling the operating system to delete the files works. According to the python documentation of the builtin open method, the open mode w does the following:

'w' for only writing (an existing file with the same name will be erased)

Assuming that's what your mode is set to, I would expect this behavior, so I don't understand why you're getting the error. It's possible that the error is due to the permissions of the files you're trying to overwrite. Try deleting them manually, then use your code to create them again and inspect the permissions. Maybe your umask needs to be changed?