def CopyTo(desc, src, dest):
import win32api, win32con
while 1:
try:
win32api.CopyFile(src, dest, 0)
return
except win32api.error, details:
if details.winerror==5: # access denied - user not admin.
raise
if silent:
# Running silent mode - just re-raise the error.
raise
tb = None
full_desc = "Error %s\n\n" \
"If you have any Python applications running, " \
"please close them now\nand select 'Retry'\n\n%s" \
% (desc, details.strerror)
rc = win32api.MessageBox(0,
full_desc,
"Installation Error",
win32con.MB_ABORTRETRYIGNORE)
if rc == win32con.IDABORT:
raise
elif rc == win32con.IDIGNORE:
return
# else retry - around we go again.
# We need to import win32api to determine the Windows system directory,
# so we can copy our system files there - but importing win32api will
# load the pywintypes.dll already in the system directory preventing us
# from updating them!
# So, we pull the same trick pywintypes.py does, but it loads from
# our pywintypes_system32 directory.
评论列表
文章目录