iOSbackup icon indicating copy to clipboard operation
iOSbackup copied to clipboard

FileNotFoundError

Open legaspacho opened this issue 5 years ago • 4 comments

Hi,

First of all, thank you for the code it is exactly what I have been looking for for a couple of days! I tried to run the code for a few different backups in order to extract my photos from them. It worked well for 2/3 of my backups.

I am basically running the following code with the correct key and udid:

b=iOSbackup(udid="something",
	derivedkey="mykey")

b.getFolderDecryptedCopy(
 	'Media',
 	targetFolder='restored-photos',
 	includeDomains='CameraRollDomain',
 	excludeFiles='%.MOV'
)

For one of the backup I am getting the following error:

Exception ignored in: <function iOSbackup.__del__ at 0x000001D68131BB80>
Traceback (most recent call last):
  File "C:...\anaconda3\lib\site-packages\iOSbackup\__init__.py", line 103, in __del__
    os.remove(self.manifestDB)
TypeError: remove: path should be string, bytes or os.PathLike, not NoneType
Traceback (most recent call last):

File "D:\....\Recover iphone backup\iphone_photo_backup.py", line 45, in <module>
    b.getFolderDecryptedCopy(

 File "C:\...\anaconda3\lib\site-packages\iOSbackup\__init__.py", line 459, in getFolderDecryptedCopy
    (info,decrypted)=self.getFileDecryptedData(fileNameHash=f['fileID'],manifestData=f['file'])

 File "C:\...\anaconda3\lib\site-packages\iOSbackup\__init__.py", line 543, in getFileDecryptedData
    with open(os.path.join(self.backupRoot, self.udid, fileNameHash[:2], fileNameHash), 'rb') as infile:

FileNotFoundError: [Errno 2] No such file or directory: 'D:\\Apple\\Path3\\MobileSync\\Backup\\MY-UDID\\78\\7831d13dae1b030538542eec78e456049beebf23'

This file does not exist in the marked folder but I am unsure 1) why it is looking to open it and 2) if there is a way it could be ignored.

Thanks,

legaspacho avatar Nov 25 '20 15:11 legaspacho

iOSbackup is trying to export it because it appears in the catalog. It is very strange it appears in the catalog but doesn't exist in the backup.

Do the following to try see the iOS file name for this faulty backup file:

from iOSbackup import iOSbackup

b=iOSbackup(udid="000…2E", derivedkey="f6…ff")

files=b.getBackupFilesList()

for f in files:
    if f['backupFile']=='7831d13dae1b030538542eec78e456049beebf23':
        print(f"{f['backupFile']}: {f['name']}")

Then add it to excludeFiles like this:

b.getFolderDecryptedCopy(
 	'Media',
 	targetFolder='restored-photos',
 	includeDomains='CameraRollDomain',
 	excludeFiles=['%.MOV', '%file-found-above.gif']
)

Let me know what you've found, maybe this is something I'll need to fix in the original code.

avibrazil avatar Dec 08 '20 08:12 avibrazil

In a few weeks I'll be releasing a new package that extract photos and videos from your backup in a curated way. It will use photo caption, face names, places, stories and albums you have tagged in your media to give you well tagged and nicely renamed files like:

2020.10.22-17.34.52 ★ Clara playing with water 【Avi Alkalay·︎iPhone 11 Pro】.jpg
2020.10.25-22.30.47 ▶️ Sun rise 【Avi Alkalay·︎iPhone 11 Pro timelapse】.mov
2020.10.27-11.41.02 • Beach in Guarujá 【Avi Alkalay·︎iPhone 11 Pro】.heic

avibrazil avatar Dec 08 '20 08:12 avibrazil

Hi avibrazil,

I edited the code to exclude the file found but it still does not work. I will wait for your next release to have it working.

Looking forward to the update !

legaspacho avatar Dec 12 '20 10:12 legaspacho

This "next release" is actually a different project. But I'll let you know here.

avibrazil avatar Dec 12 '20 18:12 avibrazil