Using images in Anvil Assets in a python-pptx slide

You’re creating a BlobMedia. According to the Anvil docs, when you create a BlobMedia, the content parameter must be a binary string containing the actual file contents. In other words, a BlobMedia isn’t what you want.

You probably want a URLMedia, where you pass in the URL. You can pass the location of the asset to it if you prepend it with the url of the environment.

After that, though, you then get the URL of the media object? Do you even need to use a media object then, if you already have the file stored in Assets (and hence already have a URL to it)?

Things I would try, in order:

  1. Get rid of the media object and try: ....add_picture(anvil.server.get_app_origin()+"/_/theme/warning_yellow.jpg", Inches(0)... May not work, but worth a try

  2. Use URLMedia instead of BlobMedia, e.g. URLMedia(anvil.server.get_app_origin()+"/_/theme/warning_yellow.jpg") Then proceed as you are already.