Open PatrickJRed opened 2 years ago
I tried it multiple times the last hours
Its always on the same event (96.85% - 4706 of 4859)
Looks like this event has a broken media url(or doesn't have an url at all). Or is it a event type I didn't expect? I cannot reproduce this issue.
Anyway, I added try-catch block to catch these "TypeError"s. Try tag:1.5, this time the script won't crash on this event. It will log the event's details so that you can trace to the event and see what's wrong with it. You can let me see the log if you want to help me debug this.
Importing keys. This may take a while... Selected room: ...:matrix.org Fetching ...:matrix.org room messages (aka ...) and writing to disk... Database ready for room: ... Fetch done!2 events for room .... Fetch done!vents for room .... Again... TypeError: can only concatenate str (not "NoneType") to str 4913 'RoomMemberEvent' object has no attribute 'url'
so what now ?
Did the script crash again? If it didn't, I think there is nothing we need to do. You see this is a RoomMemberEvent, you can just use --no-avatars flag to skip downloading them.
I think this issue is caused by some RoomMemberEvents not containing an URL of user avatar, so when it comes to downloading the url becomes None.
oh i see, it must be crashing again, my bad.
I used try-except to catch errors, but I caused another error when handling the previous error.
fixed in tag:1.6, help me test with that. show me the log if there is still issues.
as commented in issue 3 - i'll test that next week
Importing keys. This may take a while... Selected room: %PRIVATE_ROOM% Fetching %PRIVATE_ROOM% room messages (aka PRIVAT) and writing to disk... Database ready for room: PRIVAT Fetch done!9 events for room PRIVAT. Fetch done! Traceback (most recent call last):>>>>>>>>>>>>>>>--]96.85% - 4706 of 4859 File "/matrix_archive/matrix-archive.py", line 500, in
asyncio.run(main())
File "/usr/local/lib/python3.9/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/local/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
return future.result()
File "/matrix_archive/matrix-archive.py", line 478, in main
await write_room_events(client, room)
File "/matrix_archive/matrix-archive.py", line 433, in write_room_events
event_parsed = await prepare_event_for_database(event, client, room, db, temp_dir, media_dir)
File "/matrix_archive/matrix-archive.py", line 330, in prepare_event_for_database
media_data = await download_mxc(client, avatar_url)
File "/matrix_archive/matrix-archive.py", line 216, in download_mxc
content_url = getattr(client, "homeserver", "https://" + mxc.hostname) + path
TypeError: can only concatenate str (not "NoneType") to str
Its a private room - so i cannot/dont want to share the ROOM_ID (you couldnt access it anyway)