On Fri, Apr 3, 2015 at 12:28 AM, Saran A <ahlusar.ahluwa...@gmail.com> wrote: > Does this modification to copyFile do the job of moving the file? I haven't > written a test yet. > > Thanks for catching the indentation for the helper functions. > > def copyFile(src, dest): >> > try: >> > shutil.rename(src, dest) >> > # eg. src and dest are the same file >> > except shutil.Error as e: >> > print('Error: %s' % e) >> > # eg. source or destination doesn't exist >> > except IOError as e: >> > print('Error: %s' % e.strerror)
You shouldn't need shutil here; just os.rename(src, dest) should do the trick. But be careful! Now you have a function which moves a file, and it's called "copyFile". If its purpose changes, so should its name. Have fun! ChrisA -- https://mail.python.org/mailman/listinfo/python-list