Closed melissaboiko closed 4 years ago
After some investigation of the offending case:
for url in reversed(urls):
bar.next()
path = urlparse(url).path
file_name = media_dir + path
Here url
is None, which makes urlparse(url).path
be an empty bytes
rather than a string.
My urls
object at that point had 10 None
urls.
Ah, interesting! When I tried it a few hours ago I could not reproduce it but that would explain it and it would also be easy to avoid: just skip them, right? Or is the attachment still visible via the web interface?
I have no idea what it means to have an empty URL at this point of the code, but it seems resilient to skip them. I would like to understand why these URLs are coming like that, but I don’t know how…
oh I added some logging and I think I figured it out!
All the 10 statuses are audio attachments, and audio attachments have no preview_url
! you could filter the Nones out already before urls.append(url)
I think
Yeah, 2ded461 should do it, I guess?
Yeah, I did a little thing to fix the preview count too, feel free to ignore or adapt to your tastes if you want. ty for the work!
Thanks! Works for me.
This is with 1.3.1 installed today via
pip3
.