RhetTbull / osxphotos

Python app to work with pictures and associated metadata from Apple Photos on macOS. Also includes a package to provide programmatic access to the Photos library, pictures, and metadata.
MIT License
2k stars 94 forks source link

Crash on Sonoma: 'ExportDB' object has no attribute 'write_to_disk' #1298

Closed nicad closed 9 months ago

nicad commented 10 months ago

/Users/nicolas/.local/share/virtualenvs/osxphotos-wrbWIk7z-python/bin/osxphotos export /Users/nicolas/Data/Media/Photos/iCloudV6 --no-progress --export-by-date --exiftool --update --touch-file Using last opened Photos library: /Users/nicolas/Pictures/Photos Library.photoslibrary 2023-11-24 10:38:22,920 - root - WARNING - photosdb.py - 151 - WARNING: This module has only been tested with macOS versions [10.12, 10.13, 10.14, 10.15, 10.16, 11.0, 11.1, 11.2, 11.3, 11.4, 11.5, 11.6, 11.7, 12.0, 12.1, 12.2, 12.3, 12.4, 12.5, 12.6, 12.7, 13.0, 13.1, 13.2, 13.3, 13.4, 13.5, 13.6, 14.0]: you have Darwin, OS version: 14.1 Processing database /Users/nicolas/Pictures/Photos Library.photoslibrary/database/photos.db Processing database /Users/nicolas/Pictures/Photos Library.photoslibrary/database/Photos.sqlite Processing database. Database version: 6000, 9. Processing persons in photos. Processing detected faces in photos. Processing albums. Processing keywords. Processing photo details. Processing import sessions. Processing additional photo details. Processing face details. Processing photo labels. Processing EXIF details. Processing computed aesthetic scores. Processing comments and likes for shared photos. Processing moments. Processing syndication info. Processing shared iCloud library info Done processing details from Photos library. Exporting 77017 photos to /Users/nicolas/Data/Media/Photos/iCloudV6... ❌️ exiftool error for file /Users/nicolas/Data/Media/Photos/iCloudV6/2023/06/27/IMG_0397.HEIC: Error: Maker notes could not be parsed - /var/folders/tt/lwk18t610zb56yzgvkc7w3y00000gn/T/osxphotos_export_18ksjt6d/EF281732-23C2-4F0F-95E0-FC25138D0C32_exiftool.heic ❌️ Error exporting photo (EF281732-23C2-4F0F-95E0-FC25138D0C32: IMG_0397.HEIC) as /Users/nicolas/Data/Media/Photos/iCloudV6/2023/06/27/IMG_0397.HEIC: Error: Maker notes could not be parsed - /var/folders/tt/lwk18t610zb56yzgvkc7w3y00000gn/T/osxphotos_export_18ksjt6d/EF281732-23C2-4F0F-95E0-FC25138D0C32_exiftool.heic ❌️ exiftool error for file /Users/nicolas/Data/Media/Photos/iCloudV6/2023/08/14/IMG_3330.HEIC: Error: Maker notes could not be parsed - /var/folders/tt/lwk18t610zb56yzgvkc7w3y00000gn/T/osxphotos_export_tr49eoho/7AA6CF67-0F20-4FE5-84FB-66AA64B650C1_exiftool.heic ❌️ Error exporting photo (7AA6CF67-0F20-4FE5-84FB-66AA64B650C1: IMG_3330.HEIC) as /Users/nicolas/Data/Media/Photos/iCloudV6/2023/08/14/IMG_3330.HEIC: Error: Maker notes could not be parsed - /var/folders/tt/lwk18t610zb56yzgvkc7w3y00000gn/T/osxphotos_export_tr49eoho/7AA6CF67-0F20-4FE5-84FB-66AA64B650C1_exiftool.heic ❌️ exiftool error for file /Users/nicolas/Data/Media/Photos/iCloudV6/2023/11/22/IMG_4783.HEIC: Error: Maker notes could not be parsed - /var/folders/tt/lwk18t610zb56yzgvkc7w3y00000gn/T/osxphotos_export_ieflom5e/CDEF6D6F-9453-4B79-9DF3-A4BE5E550BC9_exiftool.heic ❌️ Error exporting photo (CDEF6D6F-9453-4B79-9DF3-A4BE5E550BC9: IMG_4783.HEIC) as /Users/nicolas/Data/Media/Photos/iCloudV6/2023/11/22/IMG_4783.HEIC: Error: Maker notes could not be parsed - /var/folders/tt/lwk18t610zb56yzgvkc7w3y00000gn/T/osxphotos_export_ieflom5e/CDEF6D6F-9453-4B79-9DF3-A4BE5E550BC9_exiftool.heic ❌️ exiftool error for file /Users/nicolas/Data/Media/Photos/iCloudV6/2023/03/19/IMG_7726.HEIC: Error: Maker notes could not be parsed - /var/folders/tt/lwk18t610zb56yzgvkc7w3y00000gn/T/osxphotos_export_zwave8tz/FF5D333C-2DAC-4C9E-A825-6D364C0BDBF8_exiftool.heic ❌️ Error exporting photo (FF5D333C-2DAC-4C9E-A825-6D364C0BDBF8: IMG_7726.HEIC) as /Users/nicolas/Data/Media/Photos/iCloudV6/2023/03/19/IMG_7726.HEIC: Error: Maker notes could not be parsed - /var/folders/tt/lwk18t610zb56yzgvkc7w3y00000gn/T/osxphotos_export_zwave8tz/FF5D333C-2DAC-4C9E-A825-6D364C0BDBF8_exiftool.heic ❌️ exiftool error for file /Users/nicolas/Data/Media/Photos/iCloudV6/2023/06/25/IMG_9955.HEIC: Error: Maker notes could not be parsed - /var/folders/tt/lwk18t610zb56yzgvkc7w3y00000gn/T/osxphotos_export_bdpysp89/614DBD06-68E6-49BA-A2E1-D4519A6EAED9_exiftool.heic ❌️ Error exporting photo (614DBD06-68E6-49BA-A2E1-D4519A6EAED9: IMG_9955.HEIC) as /Users/nicolas/Data/Media/Photos/iCloudV6/2023/06/25/IMG_9955.HEIC: Error: Maker notes could not be parsed - /var/folders/tt/lwk18t610zb56yzgvkc7w3y00000gn/T/osxphotos_export_bdpysp89/614DBD06-68E6-49BA-A2E1-D4519A6EAED9_exiftool.heic ❌️ exiftool error for file /Users/nicolas/Data/Media/Photos/iCloudV6/2022/11/04/IMG_5945.HEIC: Error: Maker notes could not be parsed - /var/folders/tt/lwk18t610zb56yzgvkc7w3y00000gn/T/osxphotos_export_qrvbkv6r/65CDBFB7-0AEB-4507-9942-CA4FB3E51E1A_exiftool.heic ❌️ Error exporting photo (65CDBFB7-0AEB-4507-9942-CA4FB3E51E1A: IMG_5945.HEIC) as /Users/nicolas/Data/Media/Photos/iCloudV6/2022/11/04/IMG_5945.HEIC: Error: Maker notes could not be parsed - /var/folders/tt/lwk18t610zb56yzgvkc7w3y00000gn/T/osxphotos_export_qrvbkv6r/65CDBFB7-0AEB-4507-9942-CA4FB3E51E1A_exiftool.heic ❌️ exiftool error for file /Users/nicolas/Data/Media/Photos/iCloudV6/2023/07/18/IMG_2169.HEIC: Error: Maker notes could not be parsed - /var/folders/tt/lwk18t610zb56yzgvkc7w3y00000gn/T/osxphotos_export_g799gyu2/060E3E6C-A0F2-4482-8234-2968DAD6A829_exiftool.heic ❌️ Error exporting photo (060E3E6C-A0F2-4482-8234-2968DAD6A829: IMG_2169.HEIC) as /Users/nicolas/Data/Media/Photos/iCloudV6/2023/07/18/IMG_2169.HEIC: Error: Maker notes could not be parsed - /var/folders/tt/lwk18t610zb56yzgvkc7w3y00000gn/T/osxphotos_export_g799gyu2/060E3E6C-A0F2-4482-8234-2968DAD6A829_exiftool.heic ❌️ exiftool error for file /Users/nicolas/Data/Media/Photos/iCloudV6/2022/12/03/IMG_6364.HEIC: Error: Maker notes could not be parsed - /var/folders/tt/lwk18t610zb56yzgvkc7w3y00000gn/T/osxphotos_export_nwsziv2v/4AA68208-4055-443C-9C31-D5586C30F6C5_exiftool.heic ❌️ Error exporting photo (4AA68208-4055-443C-9C31-D5586C30F6C5: IMG_6364.HEIC) as /Users/nicolas/Data/Media/Photos/iCloudV6/2022/12/03/IMG_6364.HEIC: Error: Maker notes could not be parsed - /var/folders/tt/lwk18t610zb56yzgvkc7w3y00000gn/T/osxphotos_export_nwsziv2v/4AA68208-4055-443C-9C31-D5586C30F6C5_exiftool.heic ❌️ exiftool error for file /Users/nicolas/Data/Media/Photos/iCloudV6/2023/06/06/IMG_9279.HEIC: Error: Maker notes could not be parsed - /var/folders/tt/lwk18t610zb56yzgvkc7w3y00000gn/T/osxphotos_export_wm1wpprv/2CB9394B-9CA0-4FB2-ADF2-EFBFD62E64B8_exiftool.heic ❌️ Error exporting photo (2CB9394B-9CA0-4FB2-ADF2-EFBFD62E64B8: IMG_9279.HEIC) as /Users/nicolas/Data/Media/Photos/iCloudV6/2023/06/06/IMG_9279.HEIC: Error: Maker notes could not be parsed - /var/folders/tt/lwk18t610zb56yzgvkc7w3y00000gn/T/osxphotos_export_wm1wpprv/2CB9394B-9CA0-4FB2-ADF2-EFBFD62E64B8_exiftool.heic Something went wrong and osxphotos encountered an error: 'ExportDB' object has no attribute 'write_to_disk' Crash log written to '/private/tmp/testosxphotos/osxphotos_crash.log' Please file a bug report at https://github.com/RhetTbull/osxphotos/issues with the crash log attached.

osxphotos_crash.log

RhetTbull commented 10 months ago

You've found a bug in the current branch of osxphotos. I see where the problem is and will fix it in next release. Please use the most recent released version (e.g. using pipx) instead of the version you built from the source.

RhetTbull commented 10 months ago

@all-contributors please add @nicad for bugs

allcontributors[bot] commented 10 months ago

@RhetTbull

I've put up a pull request to add @nicad! :tada:

nicad commented 10 months ago

Ok so I had tried to upgrade through pipx but there was some kind of issues where it was stuck with a 1 year old version. After some fighting I got the latest osxphotos installed through pipx and it's working now ! Thank you !

The only issue is that I'm still getting these warnings:

exiftool error for file /Users/nicolas/Data/Media/Photos/iCloudV6/2022/11/21/IMG_6132.HEIC: Error: Maker notes could not be parsed - /var/folders/tt/lwk18t610zb56yzgvkc7w3y00000gn/T/osxphotos_export_1cgxi1n4/F1402A7C-35E3-4703-9E1A-2AE790019B1F_exiftool.heic

They are not high priority because I have the files which is the most important but should I file a bug for it ?

I'm also seeing re-export when nothing has changed, do you want me to investigate it more while I'm at it ? or there are too many situations where Photos/icloud does weird things ?

Last question: is thre a way to make a donation for your work on osxphotos ? I really value it, I can leverage the Apple ecosystem without giving up control over my photos. Thanks to your work figuring the constant changes of the Photo app.

RhetTbull commented 10 months ago

Glad you got pipx upgraded. I appreciate the help running the tests.

The only issue is that I'm still getting these warnings:

The exiftool errors are caused by exiftool not being able to read the file. This happens with some files depending on how they were generated. Please verify the file /Users/nicolas/Data/Media/Photos/iCloudV6/2022/11/21/IMG_6132.HEIC exists and can be opened. If so, then there's no issue -- osxphotos should detect the exiftool errors and copy the file without the exiftool updates. If the file is missing or corrupt, let me know because that would be a bug.

I'm also seeing re-export when nothing has changed,

That shouldn't happen with the settings you're using (assume they're the same as what was in the crash log). If it is then there may be a bug. If you can narrow down a specific file and give me the UUID for it I can give you some debug commands to run to try to get to the bottom of it. The UUID will be printed in the output when using --verbose or you can find the photo in Photos, select it, then run osxphotos uuid.

Last question: is there re a way to make a donation for your work on osxphotos ?

I appreciate that very much but I don't currently accept donations for osxphotos. I'm glad it's useful for you though! I'm working on a small GUI to automatically run osxphotos export commands periodically and am thinking of making that "shareware" so you can purchase a license if you want to support osxphotos work. Will be some time before it's ready.

nicad commented 10 months ago

yes '/Users/nicolas/Data/Media/Photos/iCloudV6/2022/11/21/IMG_6132.HEIC' is there and readable.

So the first time I ran export all photos got re-exported (even though destination at almost all the files but this is the first successful post Sonoma upgrade export), 2nd export there were still a lot of updated photos and 3rd export was ok:

Processed: 77021 photos, exported: 36, updated: 20926, skipped: 52304, updated EXIF data: 20962, missing: 4616, error: 838, touched date: 20949 Elapsed time: 0:35:13

Processed: 77021 photos, exported: 0, updated: 387, skipped: 72879, updated EXIF data: 387, missing: 4616, error: 171, touched date: 387 Elapsed time: 0:09:29

I tried verbose but with 72k files it's too much output and now sync seems ok. I'll dig into it next time I get a chance.

I'll get a license of the GUI version even though I don't need it directly, I run osxphotos as part of a backup scripts so CLI is perfect for me. But it could fit family members for example and I certainly want to support osxphotos for the future.

RhetTbull commented 10 months ago

updated: 20926, skipped: 52304, updated EXIF data: 20962,

The fact that the updated # is the same as updated EXIF means that osxphotos detected that some metadata changed in Photos that caused it to determine that an update was needed. It's unusual that so many photos should change at once. This can happen if you're using Photos labels/categories (which are assigned automatically by Photos) are used as keywords in the EXIF data as these can change when Photos reprocesses the photos. However it doesn't appear you're doing that.

but this is the first successful post Sonoma upgrade export

It could be something to do with the upgrade and reprocessing done by Photos post upgrade.

RhetTbull commented 9 months ago

So the first time I ran export all photos got re-exported (even though destination at almost all the files but this is the first successful post Sonoma upgrade export), 2nd export there were still a lot of updated photos and 3rd export was ok:

If you continue to have issues with files being re-exported when you think they shouldn't be, please open a new issue. I'm closing this one as the write_to_disk problem has been fixed in osxphotos v0.65.0