GooglePhotosTakeoutHelper icon indicating copy to clipboard operation
GooglePhotosTakeoutHelper copied to clipboard

OSError: [Errno 95] Operation not supported

Open sombreroEnPuntas opened this issue 1 year ago • 3 comments

Hi!

I'm trying to run the pip package on linux. My target and output folder are on a NAS drive, but I have drwx permissions there. Why is the operation not supported? Could it be related to the file system of the Volume? It is Btrfs.

Error dump:

Traceback (most recent call last):

> File "/home/mati/.local/bin/google-photos-takeout-helper", line 8, in <module>
    sys.exit(main())
    │   │    └ <function main at 0x7f81210230a0>
    │   └ <built-in function exit>
    └ <module 'sys' (built-in)>
  File "/home/mati/.local/lib/python3.10/site-packages/google_photos_takeout_helper/__main__.py", line 720, in main
    for_all_files_recursive(
    └ <function main.<locals>.for_all_files_recursive at 0x7f8120dcef80>
  File "/home/mati/.local/lib/python3.10/site-packages/google_photos_takeout_helper/__main__.py", line 159, in for_all_files_recursive
    file_function(file)
    │             └ PosixPath('Takeout/Google Photos/CDX3L2~D/sprint.JPG')
    └ <function main.<locals>.<lambda> at 0x7f8120ddd3f0>
  File "/home/mati/.local/lib/python3.10/site-packages/google_photos_takeout_helper/__main__.py", line 722, in <lambda>
    file_function=lambda f: _walk_with_tqdm(copy_to_target(f), _copy_bar),
                         │  │               │              │   └ <tqdm.std.tqdm object at 0x7f8120d97e80>
                         │  │               │              └ PosixPath('Takeout/Google Photos/CDX3L2~D/sprint.JPG')
                         │  │               └ <function main.<locals>.copy_to_target at 0x7f8120dcfeb0>
                         │  └ <function main.<locals>._walk_with_tqdm at 0x7f8120ddc040>
                         └ PosixPath('Takeout/Google Photos/CDX3L2~D/sprint.JPG')
  File "/home/mati/.local/lib/python3.10/site-packages/google_photos_takeout_helper/__main__.py", line 663, in copy_to_target
    _shutil.copy2(file, new_file)
    │       │     │     └ PosixPath('test/sprint.JPG')
    │       │     └ PosixPath('Takeout/Google Photos/CDX3L2~D/sprint.JPG')
    │       └ <function copy2 at 0x7f8120fb1cf0>
    └ <module 'shutil' from '/usr/lib/python3.10/shutil.py'>
  File "/usr/lib/python3.10/shutil.py", line 435, in copy2
    copystat(src, dst, follow_symlinks=follow_symlinks)
    │        │    │                    └ True
    │        │    └ PosixPath('test/sprint.JPG')
    │        └ PosixPath('Takeout/Google Photos/CDX3L2~D/sprint.JPG')
    └ <function copystat at 0x7f8120fb1bd0>
  File "/usr/lib/python3.10/shutil.py", line 380, in copystat
    lookup("chmod")(dst, mode, follow_symlinks=follow)
    │               │    │                     └ True
    │               │    └ 448
    │               └ PosixPath('test/sprint.JPG')
    └ <function copystat.<locals>.lookup at 0x7f8120ddd5a0>

OSError: [Errno 95] Operation not supported: 'test/sprint.JPG'

sombreroEnPuntas avatar Sep 13 '22 16:09 sombreroEnPuntas

Uhh... honestly i have no idea... looks like system-stuff-magic...

TheLastGimbus avatar Sep 13 '22 20:09 TheLastGimbus

I think this lib could be of use: https://github.com/knorrie/python-btrfs

What's happening is that some operation on a file is not supported by the file system (btrfs) of my NAS. Can you point me to the file system operations in this project?

I'm kinda new to python but curious to make a fix for supporting this :)

sombreroEnPuntas avatar Sep 14 '22 08:09 sombreroEnPuntas

Umm... i think the devil may be the shutil.copy2:

  • https://github.com/TheLastGimbus/GooglePhotosTakeoutHelper/blob/155b0cfe3dc9f7b4d06081d7d4d6c9ec635096ef/google_photos_takeout_helper/main.py#L664
  • https://github.com/TheLastGimbus/GooglePhotosTakeoutHelper/blob/155b0cfe3dc9f7b4d06081d7d4d6c9ec635096ef/google_photos_takeout_helper/main.py#L677

It copies file with all metadata it can... maybe btrfs blocks some of that metadata, or it also tries to copy some Copy-on-write magic stuff

Btw high five for btrfs! I have it on my laptop now and it makes everything just so much smoother and faster... like butter!

So yeah, if it turned out to be big of a problem, i could test it on my pc too... maybe you just use some new experimental options etc? After all, this seems more like python->shutil problem, not ours... they could fix it upstream

TheLastGimbus avatar Sep 15 '22 13:09 TheLastGimbus