Coder Social home page Coder Social logo

Comments (9)

n2o avatar n2o commented on July 23, 2024

Also, I tried your list_files-Function to see the local files on the camera, but this always returns an empty array.

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

from python-gphoto2.

jim-easterbrook avatar jim-easterbrook commented on July 23, 2024

Very strange. I have no experience with Sony cameras, but I would expect this to work. Camera.file_delete isn't expected to return anything - it should raise an exception if gp_camera_file_delete (which it calls) returns an error. I assume by "nothing happens" you mean the image file remains on the camera SD card.

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 python -m gphoto2.

from python-gphoto2.

jim-easterbrook avatar jim-easterbrook commented on July 23, 2024

PS Do you set the camera capture target (i.e. SD card or RAM) before calling list_files? I don't know if it matters or not, but it might be worth checking.

from python-gphoto2.

n2o avatar n2o commented on July 23, 2024

Hi, thanks for the reply. Yes, it simply does not delete the file, I changed the title of this issue :-)

The output of python -m gphoto2:

python-gphoto2 version: 2.3.4
libgphoto2 version: ['2.5.27', 'standard camlibs', 'gcc', 'ltdl', 'EXIF']
libgphoto2_port version: ['0.12.0', 'iolibs: disk ptpip serial usb1 usbdiskdirect usbscsi', 'gcc', 'ltdl', 'EXIF', 'USB', 'serial without locking']
python-gphoto2 examples: /usr/local/lib/python3.9/dist-packages/gphoto2/examples

I tried the capturetarget-option, but it seems, that I can't change it 🤔

image

I have libusb-1.0.24-3 installed.

Still images are stored on the camera 😞

from python-gphoto2.

jim-easterbrook avatar jim-easterbrook commented on July 23, 2024

Setting the capture target may only last for the duration of a libgphoto2 session (i.e. until exit() or the camera is reset). But as it's already set to card+sdram then it's probably not the problem.

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.

from python-gphoto2.

jim-easterbrook avatar jim-easterbrook commented on July 23, 2024

Have you tried listing files and deleting files with the gphoto2 command? gphoto2 -v will show which version of libghoto2 it's using - it isn't necessarily the same as used by python-gphoto2.

from python-gphoto2.

n2o avatar n2o commented on July 23, 2024

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 '/'.
$ gphoto2 -v
gphoto2 2.5.27

Copyright (c) 2000-2021 Marcus Meissner and others

gphoto2 comes with NO WARRANTY, to the extent permitted by law. You may
redistribute copies of gphoto2 under the terms of the GNU General Public
License. For more information about these matters, see the files named COPYING.

This version of gphoto2 is using the following software versions and options:
gphoto2         2.5.27         gcc, popt(m), exif, cdk, aa, jpeg, readline
libgphoto2      2.5.27         standard camlibs, gcc, ltdl, EXIF
libgphoto2_port 0.12.0         iolibs: disk ptpip serial usb1 usbdiskdirect usbscsi, gcc, ltdl, EXIF, USB, serial without locking

from python-gphoto2.

n2o avatar n2o commented on July 23, 2024

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" :-)

from python-gphoto2.

jim-easterbrook avatar jim-easterbrook commented on July 23, 2024

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.
gphoto/libgphoto2#798

from python-gphoto2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.