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

Exception in callback MjpgClient._on_connect #19

Open
mkrsn opened this issue Aug 26, 2022 · 4 comments
Open

Exception in callback MjpgClient._on_connect #19

mkrsn opened this issue Aug 26, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@mkrsn
Copy link

mkrsn commented Aug 26, 2022

Hi,

right after installing and configuring motioneye.eo (22.4.1) i saw the following error.

ERROR: Exception in callback MjpgClient._on_connect(<Future finis...7f336dae47f0>>)
handle: <Handle MjpgClient._on_connect(<Future finis...7f336dae47f0>>)>
Traceback (most recent call last):
  File "/usr/lib/python3.10/base64.py", line 534, in _input_type_check
    m = memoryview(s)
TypeError: memoryview: a bytes-like object is required, not 'str'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/lib/python3.10/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/opt/motioneye/lib/python3.10/site-packages/motioneye/mjpgclient.py", line 184, in _on_connect
    auth_header = utils.build_basic_header(self._username, self._password)
  File "/opt/motioneye/lib/python3.10/site-packages/motioneye/utils/__init__.py", line 282, in build_basic_header
    return 'Basic ' + base64.encodebytes(f'{username}:{password}').replace('\n', '')
  File "/usr/lib/python3.10/base64.py", line 551, in encodebytes
    _input_type_check(s)
  File "/usr/lib/python3.10/base64.py", line 537, in _input_type_check
    raise TypeError(msg) from err
TypeError: expected bytes-like object, not str

p.s. thx for forking motioneye! 👍

@MichaIng
Copy link
Collaborator

@MichaIng MichaIng added the bug Something isn't working label Aug 26, 2022
@mkrsn
Copy link
Author

mkrsn commented Aug 26, 2022

Thx for the hint. I've changed both lines but it looks like there are some more of this problem.

2022-08-26 16:16:45: [motioneye]    ERROR: Exception in callback MjpgClient._on_connect(<Future finis...7f16e0812e60>>)
handle: <Handle MjpgClient._on_connect(<Future finis...7f16e0812e60>>)>
Traceback (most recent call last):
  File "/usr/lib/python3.10/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/opt/motioneye/lib/python3.10/site-packages/motioneye/mjpgclient.py", line 186, in _on_connect
    b'GET / HTTP/1.0\r\nAuthorization: %s\r\nConnection: close\r\n\r\n'
TypeError: %b requires a bytes-like object, or an object that implements __bytes__, not 'str'

@MichaIng
Copy link
Collaborator

Just to rule it our, could you try to migrate to the other project (which includes all the localisation features and other enhancements from here, but some additional fixes, obviously): https://github.com/motioneye-project/motioneye/tree/dev#installation

@mkrsn
Copy link
Author

mkrsn commented Aug 26, 2022

I've switched to 0.43.0, as you recommended. Exceptions are gone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants