PythonWin 2.1 saving bugg???

Fredrik Lundh fredrik at pythonware.com
Wed Oct 31 14:57:14 CET 2001


Neil Hodgson wrote:
>    What it does is, with error checking removed:
>
>    os.unlink(bakFileName)
>    os.rename(fileName, bakFileName)
>    self.SaveFile(fileName)

you probably should consider:

    os.unlink(tempFileName)
    self.SaveFile(tempFileName)
    os.unlink(bakFileName)
    os.rename(fileName, bakFileName)
    os.rename(tempFileName, fileName)

where tempFileName is a file in the same directory as
fileName.

(adding the right try/excepts are left as an exercise)

</F>

<!-- (the eff-bot guide to) the python standard library:
http://www.pythonware.com/people/fredrik/librarybook.htm
-->





More information about the Python-list mailing list