[FIXED] BlobMedia example from docs still not working

Hi Anvil team… I’m just following the tutorials on Media components and saw this thread was closed and marked fixed:

My app is in Python 3.7 and I’m just playing with the example given in the tutorial namely:

file_contents = "Hello, world"
my_media = anvil.BlobMedia(content_type="text/plain", content=file_contents, name="hello.txt")

I get…
TypeError: content type must be a string, not <invalid type> at [MergeCaptions, line 38](javascript:void(0))

Changing from kwargs to args gives:
TypeError: content must be a byte-string, not str at [MergeCaptions, line 38](javascript:void(0))

Changing from kwargs to args AND adding .encode('utf-8') after my (string) content works however.

Could I suggest this isn’t FIXED and either the docs need to catch up with code or the code needs to catch up with the docs?

Cheers,
Peter

Yep, that’s a bug! Moving to Bug Reports.

1 Like

Thanks for this report - the issue with keyword arguments is now fixed, and the docs have been updated. You will see those changes go live over the next few days.

1 Like