Coder Social home page Coder Social logo

Comments (6)

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

I doubt it's a bug in the Python interface, especially as other cameras work OK. What does the gphoto2 command line client report? (gphoto2 --storage-info)

If, as I expect, the CLI client also returns nothing then it's a question for the gphoto2 mailing list.

from python-gphoto2.

damonlynch avatar damonlynch commented on July 23, 2024

I'd wondered the same, but I asked the user to double check and this is what is returned:

$ gphoto2 --storage-info
[Storage 0]                                                                   
label=NIKON D800  [Slot 1]
basedir=/store_00010001
access=2 Nur Lesen und Bilder löschen
type=4 Entfernbarer RAM
fstype=4 Kamera Struktur (DCIM)
totalcapacity=7878464 KB
free=7393472 KB
freeimages=1604
[Storage 1]
label=NIKON D800  [Slot 2]
basedir=/store_00020001
access=2 Nur Lesen und Bilder löschen
type=4 Entfernbarer RAM
fstype=4 Kamera Struktur (DCIM)
totalcapacity=31248384 KB
free=13976416 KB
freeimages=179

from python-gphoto2.

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

No description in that result. (-:

PS You can iterate over a list directly, rather than using an index. Instead of

        for media_index in range(len(self.storage_info)):
            info = self.storage_info[media_index]
            ...

just do

        for info in self.storage_info:
            ...

from python-gphoto2.

damonlynch avatar damonlynch commented on July 23, 2024

Oh yes, you're right. gPhoto2 leaves the entire field out altogether instead of reporting a blank value.

Being able to treat the libgphoto2 result as a proper Python iterable is very useful - was that something you changed at some point? Or perhaps I was too cautious with my code all along. I do have a dim memory of running into the problem of not being able to iterate with some returned result at some point.

from python-gphoto2.

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

In this particular case the result is a pure Python list. Other libgphoto2 types that have 'count' and 'index' methods (e.g. gp_abilities_list_count and gp_abilities_list_get_abilities) can behave like lists if I add __len__ and __getitem__ methods in the interface. (See https://docs.python.org/2.7/reference/datamodel.html?highlight=__len__#emulating-container-types) I need to check if I've done this everywhere.

from python-gphoto2.

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

If you run into any problems with iteration in future do let me know. With Python 2 & 3, and "builtin" vs non "builtin" versions of SWIG output I don't always find problems in my limited testing.

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.