Skip to content
This repository has been archived by the owner on Oct 24, 2018. It is now read-only.

TypeError: a bytes-like object is required, not 'str' #44

Open
rreuvekamp opened this issue Oct 26, 2017 · 0 comments
Open

TypeError: a bytes-like object is required, not 'str' #44

rreuvekamp opened this issue Oct 26, 2017 · 0 comments

Comments

@rreuvekamp
Copy link

rreuvekamp commented Oct 26, 2017

I get these unhandled exceptions when starting the bridge.
The second one is when sending a message from Telegram.
Bridging doesn't work (because of this), the Telegram bot does respond to '/alias'.

$ docker logs matrix_telematrix_1
ERROR:aiohttp.web:Error handling request
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/aiohttp/server.py", line 261, in start
    yield from self.handle_request(message, payload)
  File "/usr/lib/python3.6/site-packages/aiohttp/web.py", line 88, in handle_request
    resp = yield from handler(request)
  File "/telematrix/telematrix/__init__.py", line 219, in matrix_transaction
    displayname = response['displayname']
TypeError: byte indices must be integers or slices, not str
ERROR:asyncio:Task exception was never retrieved
future: <Task finished coro=<aiotg_message() done, defined at /telematrix/telematrix/__init__.py:594> exception=TypeError("a bytes-like object is required, not 'str'",)>
Traceback (most recent call last):
  File "/telematrix/telematrix/__init__.py", line 679, in aiotg_message
    if 'errcode' in j and j['errcode'] == 'M_FORBIDDEN':
TypeError: a bytes-like object is required, not 'str'

I'm running telematrix is docker. Here is the Dockerfile, in case it is of use:

FROM alpine:latest

# Update
RUN apk add --update build-base python3-dev py-pip jpeg-dev zlib-dev git bash
ENV LIBRARY_PATH=/lib:/usr/lib

# Install app dependencies
RUN git clone https://github.com/SijmenSchoon/telematrix.git

WORKDIR /telematrix

RUN pip3 install -r requirements.txt

WORKDIR /data

CMD ["python3", "/telematrix/app_service.py"]

Maybe you'd like the docker-compose file to. In that case :) :

    image: my_telematrix

    working_dir: "/data"

    ports:
      - "127.0.0.1:9910:9910"
    
    volumes:
      - /opt/matrix/telematrix:/data

To me it seems I'm using an incorrect version of aiotp. I've tried upgrading it to the latest ("pip3 install aitop --upgrade"), but that gives other errors.

Maybe the requirements.txt file is out of date?

I've poked around a bit myself. After fixing line 679, other (Type)Errors emerge, so that is why I think it's a dependency problem.

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

No branches or pull requests

1 participant