Any Windows users here?

According to the documentation, os.rename(original, new) will fail if new
already exists.

Would somebody be kind enough to tell me what OSError is raised? In
particular:

# Untested.
import os
open('a123.junk', 'w')
open('b123.junk', 'w')
try:
    os.rename('a123.junk', 'b123.junk')
except OSError as e:
    print(e.winerror)  # Windows only
    print(e.errno)
    print(repr(e))

os.unlink('a123.junk')
os.unlink('b123.junk')



I'd test it myself, except I don't have access to Windows with Python.

Thanks in advance.



-- 
Steven

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to