My mistake, the program I sent you has a variable referenced before definition 
error. This new program I sent you runs perfectly on my camera by itself but 
breaks down once my lens is attached. Thank you again for all your help!

Nainoa Jorg

________________________________
From: Nainoa Jorg <nainoa.j...@us.kbr.com>
Sent: Monday, May 13, 2024 1:06 PM
To: gphoto-devel@lists.sourceforge.net <gphoto-devel@lists.sourceforge.net>
Subject: In need of gphoto2 support

Hello,

I'm a software engineer trying to write a program for my Fujifilm X-T5 camera 
to take photos over the course of an entire night of the night sky. I can 
successfully get the program to do that when I'm just using the camera, but my 
program breaks down the second I attach the Fujinon Lens Super EBC XF 200mm 1:2 
R LM OIS WR.
I've attached the log file from trying to run my program as well as the program 
that is creating these results. Any sort of feedback or recommendations would 
be greatly appreciated. Thank you so much for your help.

Thank you,
Nainoa Jorg
This e-mail, including any attached files, may contain confidential 
information, privileged information and/or trade secrets for the sole use of 
the intended recipient. Any review, use, distribution, or disclosure by others 
is strictly prohibited. If you are not the intended recipient (or authorized to 
receive information for the intended recipient), please contact the sender by 
reply e-mail and delete all copies of this message.
import subprocess
import os
import time
from datetime import datetime
import random

def generate_date_code():
    """Generate a random string of numbers based on today's date down to the second."""
    now = datetime.now()
    formatted_date = now.strftime("%Y%m%d%H%M%S")
    random_code = ''.join(random.choices('0123456789', k=6))  # Generating a random 6-digit number
    return f"{formatted_date}_{random_code}"

def capture_image_and_download():
    bulb = 1.0

    num_photos = 1
    duration = 86400
    start_time = time.time()
    output_file = "my-logfile.txt"

    try:
        folder_name = f"AstrophotographyPhotos_{generate_date_code()}"

        os.makedirs(folder_name)
        print(f"Images will be download to {folder_name}")

        os.chdir(folder_name)



        while time.time() - start_time < duration:
            filename = "name_test_" + str(num_photos) + ".%C"  # %n for filename and %C for file extension

            subprocess.run(["gphoto2", "--capture-image-and-download", f"-B={bulb}", f"--filename={filename}"], check=True)

            print("Image captured and downloaded successfully!")
            num_photos += 1

    except subprocess.CalledProcessError as e:
        # Handle any errors that occur during execution
        print("Error:", e)

if __name__ == "__main__":
    # Call the function to capture image and download
    capture_image_and_download()
_______________________________________________
Gphoto-devel mailing list
Gphoto-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gphoto-devel

Reply via email to