-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
delete_file()
does not delete file
#157
Comments
Also, I tried your def list_files(camera, path="/"):
result = []
# get files
for name, value in camera.folder_list_files(path):
result.append(os.path.join(path, name))
# read folders
folders = []
for name, value in camera.folder_list_folders(path):
folders.append(name)
# recurse over subfolders
for name in folders:
result.extend(list_files(camera, os.path.join(path, name)))
return result |
Very strange. I have no experience with Sony cameras, but I would expect this to work. Check you have libusb1 installed - libusb0 is known to be problematic with some cameras. Other than that I have nothing to suggest. BTW you can find out what version of libgphoto2 you are using with |
PS Do you set the camera capture target (i.e. SD card or RAM) before calling |
delete_file()
does not delete file
Setting the capture target may only last for the duration of a libgphoto2 session (i.e. until Libgphoto2 2.5.27 isn't ridiculously old (released Feb 2021). The release notes for 2.5.28 include "Sony: mark all widgets as read-write again, read-only logic was not 100% correct" which might explain your capture target setting problem. I can't find anything relevant to deleting pictures though. |
Have you tried listing files and deleting files with the |
Ah, good point. gphoto2 can't even list my files via CLI. Maybe it's just a Sony thing. For my Customer we use Nikon cameras and it works on these cameras. I have no Nikon available currently, which is why I have to work on a Sony camera. Strange, that this function does not work on a Sony camera. $ gphoto2 --list-files
There is no file in folder '/'.
|
Actually it seems like a problem with the Sony camera. I tested it on Nikon cameras, which worked as I expected it. Thanks for your help, so I'm closing this and leaving it with "My Sony a6500 simply does not support this" :-) |
Just spotted this comment on a libgphoto2 bug report: "For Sony cameras, in pc control mode there is no folder access. It is only accessible in MTP/PTP mode." It might be relevant. |
Your system
Raspberry Pi 4
What version of Python are you using?
python 3.9.2
What version of libgphoto2 have you installed?
How have you installed (or attempted to install) python-gphoto2?
Yes, installed version 2.3.4 via pip
Your problem
As far as I can see, there is no possibility to call the function
capture-image-and-download
. So I want to take a picture, download it and delete it afterwards. But when I callfile_delete()
as in your example, nothing happens.That's the relevant function. Taking picture, setting settings etc. works as expected, but the
file_delete()
-function does simply do nothing and return None.I am using a Sony a6500 camera.
I initialize the camera with this code:
Do you have any ideas on this?
Thanks!
The text was updated successfully, but these errors were encountered: