canvas_grab icon indicating copy to clipboard operation
canvas_grab copied to clipboard

File Exists Error when synchronizing

Open jbxiaoyu opened this issue 2 years ago • 2 comments

 Traceback (most recent call last):
  File "D:\Google Drive\Year 2 Sem 2\Z_CANVAS_GRAB\main.py", line 6, in <module>
    canvas_grab.__main__.main()
  File "D:\Google Drive\Year 2 Sem 2\Z_CANVAS_GRAB\canvas_grab\__main__.py", line 68, in main
    transfer.transfer(
  File "D:\Google Drive\Year 2 Sem 2\Z_CANVAS_GRAB\canvas_grab\transfer.py", line 42, in transfer
    for _ in self.yield_transfer(base_path, archive_base_path, plans):
  File "D:\Google Drive\Year 2 Sem 2\Z_CANVAS_GRAB\canvas_grab\transfer.py", line 59, in yield_transfer
    file_obj.rename(archive_path)
  File "C:\Users\jbxia\miniconda3\lib\pathlib.py", line 1377, in rename
    self._accessor.rename(self, target)
FileExistsError: [WinError 183] Cannot create a file when that file already exists: 'files\\BIS 681 01 (SP22)_ Statistical Practice II\\3. Panel discussion\\Bios and contact info statistical practice panel 2022.docx' -> 'files/_canvas_grab_archive/files/BIS 681 01 (SP22)_ Statistical Practice II/3. Panel discussion/Bios and contact info statistical practice panel 2022.docx'

Since the file names are the same, why it will have such error?

jbxiaoyu avatar Feb 11 '22 16:02 jbxiaoyu

It seems that the issue occurs when canvas_grab tries to archive old version of the file.

Maybe the rename semantics of Windows is different from Linux. On *nix systems, rename will overwrite the target file.

You may delete the _canvas_grab_archive folder and try again.

skyzh avatar Feb 11 '22 17:02 skyzh

It seems that the issue occurs when canvas_grab tries to archive old version of the file.

Maybe the rename semantics of Windows is different from Linux. On *nix systems, rename will overwrite the target file.

You may delete the _canvas_grab_archive folder and try again.

Would you mind to solve this bug in the next version? Thank you.

Btw, really appreciate your work.

jbxiaoyu avatar Feb 11 '22 19:02 jbxiaoyu

Using replace() instead of rename() may help. See https://github.com/certbot/certbot/issues/4510.

wang-jiahua avatar Sep 12 '22 16:09 wang-jiahua