shutil - Python Cannot create a file error [Error : 183] -
i using following code copy contents of 1 directory directory (python)
shutil.copytree(sourcedirectory,destinationdirectory,symlinks=false,ignore=ignore_patterns(updatedlist))
where
updatedlist = ,.config,.ico,*.log
i generating updatedlist on fly (based on user inputs) keep getting following error whenever try perform copy operation stated above.
[error 183] cannot create file when file exists
note : there files present in source directory matching extensions mentioned in updatedlist.
i thinking mentioning extension of files present in ignore list should suffice, apparently not.
i using python 2.7
my imports
import logging import os win32api import getfileversioninfo, loword, hiword import zipfile import shutil import sys os.path import isfile distutils import dir_util import configdto import datetime import updatesettings import time import win32api import socket shutil import copytree, ignore_patterns import os
please .
thanks
i .. sorry mistake. document shutil says destination directory must not exist. in case , destination directory existing earlier , hence getting message.
thanks
Comments
Post a Comment