What I’m trying to do:
I want to create a zip file out of a directory inside the /tmp folder.
What I’ve tried and what’s not working:
I have tried using shutil to create a directory, and passing the file from the server to a download button in the user form.
Code Sample:
# this is a formatted code snippet.
Client form:
anvil.media.download(anvil.server.call('get_zip', path.user_path))
Server:
def get_zip(path):
my_zip = shutil.make_archive('Motor Data', 'zip', f'/tmp/{path}')
return my_zip
# paste your code between ```
The error I get is:
AttributeError: ‘str’ object has no attribute ‘url’