Coder Social home page Coder Social logo

Comments (4)

jim-easterbrook avatar jim-easterbrook commented on June 24, 2024

I don't think you'll get any error messages unless you use gp.use_python_logging() to get gphoto2 error messages sent to Python's logging system.

Setting camera clocks seems to be very make & model dependent. See the set-camera-clock.py example - it works for my Cannon cameras but I can't promise it works on others. The datetimeutc config uses int(time.time()), the syncdatetime config takes the value 1, and the datetime config takes an int or str representation of the time depending on the widget type.

from python-gphoto2.

jensanjo avatar jensanjo commented on June 24, 2024

If I use set-camera-clock.py the resulting time is off by 3600 sec. It uses the syncdatetime config.
I think the 3600 sec offset is a timezone issue (I am in Europe/Amsterdam).
Because the syncdatetime config does not work for me, I need the datetime config.
That works when I use gphoto2, but not with python-gphoto2 2.3.4.
Any ideas?

I added logging to the test script:

import gphoto2 as gp
import logging

# setup python logging
logging.basicConfig(
        format='%(levelname)s: %(name)s: %(message)s', level=logging.WARNING)
callback_obj = gp.check_result(gp.use_python_logging())    

# try to set the camera datetime
camera = gp.Camera()
camera.init()
config = camera.get_config()
OK, date_config = gp.gp_widget_get_child_by_name(config, 'datetime') 
assert(OK == gp.GP_OK)
now = int(time.time())
date_config.set_value(now)
camera.set_config(config)
assert(now == date_config.get_value())  # the datetime config is properly set
camera.exit()

But the output does not seem relevant:

WARNING: gphoto2: (gp_port_usb_close [libusb.c:309]) Invalid parameters: 'port && port->pl->dh' is NULL/FALSE.

from python-gphoto2.

jim-easterbrook avatar jim-easterbrook commented on June 24, 2024

If you look at set-camera-clock.py you'll see it uses the datetimeutc config for my Canon EOS 100D - I expect you need to do the same with your Canon.

from python-gphoto2.

jensanjo avatar jensanjo commented on June 24, 2024

Thanks! That works. I have to add the utc offset (3600 or 7200 seconds depending on daylight saving) to the datetimeutc value to get a correct datetime.

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.