Gphoto2 on jetson

I am trying to read a image in opencv which is taken by gphoto2 but have success in doing so. below is the error i get. MY image is taken from a DSLR via usb to Jetson nano.

Failed to create the new directory.
Traceback (most recent call last):
  File "", line 74, in <module>
TypeError: Expected Ptr<cv::UMat> for argument 'mat'

My Algorithm is :

import time 
#import sleep
from datetime import datetime
from sh import gphoto2 as gp
import signal , os,subprocess
import cv2
import numpy as np
from PIL import Image
from cStringIO import StringIO

import Jetson.GPIO as GPIO

channel = 7



GPIO.setup(channel, GPIO.IN)

#Kill the gphot porcess that starts when ever we connect the camera after a power cycle

def killgphoto2Process():
    p = subprocess.Popen(['ps','-A'],stdout = subprocess.PIPE)
    out , err = p.communicate()

    #search for the line that has the process
    #we want to kill
    for line in out.splitlines():
        if b'gvfsd-ghoto2' in line :
            #kil the process
            pid = int(line.split(None,1)[0])
            os.kill(pid , signal .SIGKILL)

shot_date ="%Y-%m-%d")
shot_time ="%Y-%m-%d %H:%M:%S")

picID = ""

trigger_and_download= ["--stdout","--capture-image-and-download"]

folder_name = shot_date + picID

save_location = "images/" + folder_name

def createSaveFolder():
        print("Failed to create the new directory.")

def captureImages():
    return gp(trigger_and_download)

def renameFiles(ID):
    for filename in os.listdir("."):
        if len(filename) < 13 :
            os.rename(filename , (shot_time +ID + ".JPG"))



while True:
    z = GPIO.input(channel)
    if z == 0:
        qwe= captureImages()

their is a way around to first write the image on storage and then read it. but this is ugly engineering and is slow. i want to read it from the system ram

keeping in mind i already have gphoto2 istalled but canot make it python work

I would start here: GitHub - jim-easterbrook/python-gphoto2: Python interface to libgphoto2