pymobiledevice3
pymobiledevice3 copied to clipboard
Handling `DeviceLocked` error
Is your feature request related to a problem? Please describe. When trying to mount and device locked via the cli, you get a big traceback, which can be confusing for less technical people.
Describe the solution you'd like It could be nice to handle it and display it properly.
Additional context Here's the traceback:
n@MacBook-Pro-14-de-N ~ % pymobiledevice3 mounter auto-mount
2023-12-01 12:13:51 MacBook-Pro-14-de-N.local pymobiledevice3.restore.tss[2195] INFO Sending TSS request...
2023-12-01 12:13:51 MacBook-Pro-14-de-N.local pymobiledevice3.restore.tss[2195] INFO response successfully received
Traceback (most recent call last):
File "/opt/homebrew/bin/pymobiledevice3", line 8, in <module>
sys.exit(cli())
^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/pymobiledevice3/cli/cli_common.py", line 134, in wrap_callback_calling
callback(service_provider=service_provider, **kwargs)
File "/opt/homebrew/lib/python3.11/site-packages/pymobiledevice3/cli/mounter.py", line 122, in mounter_auto_mount
auto_mount(service_provider, xcode=xcode, version=version)
File "/opt/homebrew/lib/python3.11/site-packages/pymobiledevice3/services/mobile_image_mounter.py", line 362, in auto_mount
auto_mount_personalized(lockdown)
File "/opt/homebrew/lib/python3.11/site-packages/pymobiledevice3/services/mobile_image_mounter.py", line 355, in auto_mount_personalized
PersonalizedImageMounter(lockdown=lockdown).mount(image, build_manifest, trustcache)
File "/opt/homebrew/lib/python3.11/site-packages/pymobiledevice3/services/mobile_image_mounter.py", line 213, in mount
self.upload_image(self.IMAGE_TYPE, image, manifest)
File "/opt/homebrew/lib/python3.11/site-packages/pymobiledevice3/services/mobile_image_mounter.py", line 115, in upload_image
raise PyMobileDevice3Exception(f'command ReceiveBytes failed with: {result}')
pymobiledevice3.exceptions.PyMobileDevice3Exception: command ReceiveBytes failed with: {'Error': 'DeviceLocked'}
For community
⬇️ Please click the 👍 reaction instead of leaving a +1 or 👍 comment
You can also submit a PR that adds this
@novitae Has the problem solved ? I had the same problem.
Was already fixed a long time ago. Users now get: Device is password protected. Please unlock and retry