luxonis / depthai-experiments

Experimental projects we've done with DepthAI.
MIT License
801 stars 357 forks source link

Cannot import "EncodingQuality" from "depthai_sdk" #478

Closed kimjsik08 closed 5 months ago

kimjsik08 commented 1 year ago

I am having this error:

Traceback (most recent call last):
  File "C:\Users\kimjs\PycharmProjects\OakD\depthai-experiments\gen2-record-replay\record.py", line 12, in <module>
    from depthai_sdk import Record, EncodingQuality
ImportError: cannot import name 'EncodingQuality' from 'depthai_sdk' (C:\Users\kimjs\PycharmProjects\OakD\venv\Lib\site-packages\depthai_sdk\__init__.py)

I tried to manually go through sdk files and find "EncodingQuality" function, but I could not. Am I missing something here?

Maybe it has to do something with the fact that I had a problem installing something from requirements.txt file?

Building wheels for collected packages: depthai
  Building wheel for depthai (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for depthai (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [72 lines of output]

Maybe this error is not an issue because I already had depthai 2.21 installed...

Erol444 commented 1 year ago

Hi @kimjsik08 , do you have depthai-sdk version 1.2.3 installed, as per requirements.txt?

kimjsik08 commented 1 year ago

Hello, I applied your fix and now I am getting a new type of error!

  File "C:\Users\kimjs\PycharmProjects\OakD\depthai-experiments\gen2-record-replay\record.py", line 17, in <module>
    _quality_choices = tuple(str(q).split('.')[1] for q in EncodingQuality)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\kimjs\PycharmProjects\OakD\depthai-experiments\gen2-record-replay\record.py", line 17, in <genexpr>
    _quality_choices = tuple(str(q).split('.')[1] for q in EncodingQuality)
                             ~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range
Erol444 commented 1 year ago

Hi @kimjsik08 , Could you please try https://github.com/luxonis/depthai-experiments/pull/480 ?

whyhowie commented 6 months ago

I think you could change that line 17 into: _quality_choices = tuple([q.name for q in EncodingQuality]) Should fix the problem.

kimjsik08 commented 5 months ago

_quality_choices = tuple([q.name for q in EncodingQuality])

This fixed the problem. Thanks, I appreciate it!