Coder Social home page Coder Social logo

Comments (4)

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

This is because capture_preview now has two optional parameters - a CameraFile and a Context (or GPContext). If you need to pass a Context you also need to pass a CameraFile, which can be created with camera_file = gp.CameraFile(). In this case the CameraFile object is not returned by capture_preview.

The "pythonic" way to do this would be with named/keyword parameters. I'll investigate if I can do this with SWIG.

You don't normally need a Context - it's only used if you need callbacks during some functions.

from python-gphoto2.

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

You can also use None instead of a CameraFile object. capture_preview will then behave as before, returning a new CameraFile object.

from python-gphoto2.

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

The "pythonic" way to do this would be with named/keyword parameters. I'll investigate if I can do this with SWIG.

SWIG can create keyword arguments, but it's an all or nothing option. Changing all python-gphoto2 function arguments to keyword arguments would be a big change (and wouldn't allow overloaded functions that are currently used).

from python-gphoto2.

Sparkofska avatar Sparkofska commented on July 23, 2024

Great! Thanks for the instant response!

Passing None instead of CameraFile works.

Thanks also for the hint of not needing a Context. I removed this variable entirely and it still works :)

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.