Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lepton3 - Module is not callable #69

Open
ghost opened this issue Apr 15, 2022 · 2 comments
Open

Lepton3 - Module is not callable #69

ghost opened this issue Apr 15, 2022 · 2 comments

Comments

@ghost
Copy link

ghost commented Apr 15, 2022

I am trying to use Lepton 3.5, along with python. I am trying to use Pylepton library with my python3 and Raspberrypi 4 Model B.

I just found that there has been a branch updated about 3 months ago for a new file called Lepton3.py. I am trying to import this file in my code, however I am getting this when trying to import: "Module is not callable" from Pyright reportGeneralTypeIssues.

My code:

import sys
import numpy as np
from cv2 import cv2
from pylepton import Lepton3

def capturePic():
with Lepton3() as l:
a,_ = l.capture()
cv2.normalize(a, a, 0, 65535, cv2.NORM_MINMAX)
np.right_shift(a, 8, a) #fits the data into 8 bits)
cv2.imwrite("output.jpg", np.uint8(a)) #writes image to file

if name == 'main':

print("capturing image and saving to output.jpg in current directory")
capturePic()

=============================================================

In the "def capturePic():" function, I have changed the "with Lepton3() as l:" to "with Lepton(): as l:" and it still does not work and the error becomes " 'Lepton' is not defined "

I looked and compared the Lepton.py file and Lepton3.py file, and the only difference in the class I see is Lepton.py has class Lepton(object): and Lepton3.py has class Lepton3(Lepton): as its definition.

I tried using "with Lepton3(Lepton) as l:" but that also did not work.

Could someone assist with this issue if you have experienced/resolved this on your end?

@Antuto
Copy link

Antuto commented May 25, 2022

Hello !
Simply change the from pylepton import Lepton3 to from pylepton.Lepton3 import Lepton3 and it should work ;)

@AbhishekGupta2002
Copy link

its not working the same error is still coming

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants