Accessing files/folders through anvil server

I’m building a web app and taking a zip file as a user input. I’m extracting the zip file in my own directory (since i myself am the server i.e. using jupyter notebook as a server).

I decided to use jupyter notebook first, because i was not able to use some important python libraries like tensorflow, keras, etc on Anvil’s free plan.

Now i am planning to use Anvil’s payment plans for anvil’s server so that my website is available to all the users ‘all the time’. Since it is not possible using jupyter notebook because the notebook has to be in the running condition ‘all the time’ for Anvil to access the methods/functions.

Is there any way to unzip the zip file (provided by the user) on my directory or on the server? without using data tables or any other database?

I tried to access my own directory but Anvil is not able to access it. Got the following error:

NoServerFunctionError: [Errno 2] No such file or directory:
'C:\\Users\\Hira\\dataset'
at ServerMoule1, line 18
 called from Form1, line 15

Considering that the Anvil server-side code is running in an entirely different computer – the Anvil server – that may be thousands of kilometers away from you, I’d be more surprised if it worked. It would be a terrible security problem, if code running on other computers could access your local files.

In this case (and many others), the above links Docs and Search can really help you. Leading you to, for example, Files in Server Modules.

Just be aware, any files you create on the Server are just temporary. They may not live very long. Their disk space can be reclaimed at any time, once your Server-side function returns.

1 Like