zivid / zivid-python

Official Python package for Zivid 3D cameras
BSD 3-Clause "New" or "Revised" License
40 stars 14 forks source link

the python api doesnt work straight a way #213

Closed Hanjinchao closed 1 year ago

Hanjinchao commented 1 year ago

I am using windows 10, the zivid studio is working I had python3.74 and pip installed zivid api, then I copied example code from the readme but I got this error message:

ImportError: cannot import name 'Application' from 'zivid' or

app = zivid.Application()
AttributeError: module 'zivid' has no attribute 'Application'
eskaur commented 1 year ago

Can I see the entire code of the script you are running to test this?

Hanjinchao commented 1 year ago
import zivid 
# from zivid import Application, Settings
app = zivid.Application()

this is the error message:

Traceback (most recent call last): File "c:/Users/../Documents/scaner_test/zivid.py", line 1, in import zivid File "c:\Users..\Documents\scaner_test\zivid.py", line 3, in app = zivid.Application() AttributeError: module 'zivid' has no attribute 'Application' PS C:\Users..\Documents\scaner_test>

and I got the zivid studio working as well: image

Hanjinchao commented 1 year ago

PS C:\Users..\Documents\scaner_test> pip install zivid Requirement already satisfied: zivid in c:\python\python37\lib\site-packages (2.8.0.2.9.0) Requirement already satisfied: numpy in c:\python\python37\lib\site-packages (from zivid) (1.21.6)

eskaur commented 1 year ago

Aha, I think you have a naming conflict because you also have a file called zivid.py. So when you do import zivid it imports your file instead of our package. Try renaming your zivid.py to something else.

Hanjinchao commented 1 year ago

yeah you right, that was a silly mistake, thanks a lot !!

eskaur commented 1 year ago

No problem. Thank you for closing the issue.