Anvil TempFile Printing File Extension

What I’m trying to do:
I am trying to pass a file(anvil.Blobmedia) into the anvil.media.TempFile() Context Manager. However I notice that when the code runs the anvil.media.TempFile() Context Manager prints the file extension that is passed into the Context Manager to the console.

for example if I pass a txt anvil.Blobmedia file into anvil.media.TempFile() then ‘txt’ is printed to the console and same if I pass a csv anvil.Blobmedia file into anvil.media.TempFile() then ‘csv’ is printed to the console.

Will appreciate any assistance in I can get on resolving this.

Thank you very much.

Code Sample:

file = anvil.BlobMedia(
        content_type='text/plain', 
        content=b'Hello, world!', 
        name='hello.txt'
    )
    
with anvil.media.TempFile(file): # <-- prints the file extension that is passed into the TempFile class
        pass

Clone link:
share a copy of your app

I have added server module _ with the code example, when you copy the app:
Run this in a server repel:

from .AnvilTempFileTest import test
test()

and you should expect this output → “txt”

[Moved to Bug Reports]

Whoops! That’s a piece of debug code that slipped into the deployed version. It’s harmless (just noisy in the logs); we’ll get that whacked in the next couple of days.

2 Likes

Thank you very much :+1: