Benjamin-Loison / matrix-commander

simple but convenient CLI-based Matrix client app for sending and receiving
GNU General Public License v3.0
0 stars 0 forks source link

`matrix-commander --devices` `E215: Error during room, set, get actions. Continuing despite error. Exception: can only concatenate str (not "NoneType") to str` #18

Open Benjamin-Loison opened 3 months ago

Benjamin-Loison commented 3 months ago
matrix-commander --devices
2024-06-27 20:57:36,668:    ERROR: matrix-commander: E215: Error during room, set, get actions. Continuing despite error. Exception: can only concatenate str (not "NoneType") to str
2024-06-27 20:57:36,670:     INFO: matrix-commander: 1 error and 0 warnings occurred.

On OC3K benjamin.

matrix-commander -h
--devices, --get-devices
  Print the list of devices.
Benjamin-Loison commented 3 months ago

On LemnosLife VPS:

find / -name 'matrix_commander.py' 2> /dev/null
/usr/local/lib/python3.9/dist-packages/matrix_commander/matrix_commander.py
/usr/local/lib/python3.11/dist-packages/matrix_commander/matrix_commander.py
Benjamin-Loison commented 3 months ago
rr.id='CENSORED'
rr.display_name='CENSORED'
type(rr.last_seen_ip)=<class 'str'>
rr.last_seen_ip='CENSORED'
type(rr.last_seen_date)=<class 'datetime.datetime'>
rr.last_seen_date=datetime.datetime(CENSORED)
rr.id='CENSORED'
rr.display_name='CENSORED'
type(rr.last_seen_ip)=<class 'NoneType'>
rr.last_seen_ip=None
type(rr.last_seen_date)=<class 'NoneType'>
rr.last_seen_date=None
rr.id='CENSORED'
rr.display_name='CENSORED'
type(rr.last_seen_ip)=<class 'str'>
rr.last_seen_ip='CENSORED'
type(rr.last_seen_date)=<class 'datetime.datetime'>
rr.last_seen_date=datetime.datetime(CENSORED)

I have 3 devices with both rr.last_seen_{ip,date} None they are matrix-commander on Termux and Ubuntu server and app.element.io.

Adding --debug provides the traceback (hence avoid above find) and with:

4570a4571,4576
>             gs.log.debug(f'{rr.id=}')
>             gs.log.debug(f'{rr.display_name=}')
>             gs.log.debug(f'{type(rr.last_seen_ip)=}')
>             gs.log.debug(f'{rr.last_seen_ip=}')
>             gs.log.debug(f'{type(rr.last_seen_date)=}')
>             gs.log.debug(f'{rr.last_seen_date=}')

https://github.com/8go/matrix-commander/commit/5b94b0406404711c1cb3dabadf4538b90f352821

is the first commit about rr.last_seen_date but it does not explain why it uses str.

diff matrix_commander.py /usr/local/lib/python3.11/dist-packages/matrix_commander/matrix_commander.py
4576c4576
<                 + rr.last_seen_ip
---
>                 + str(rr.last_seen_ip)

solves the issue.