I cannot run OS commands on streamlit cloud

Hi,

I have deployed the application here

I have the github repository

python 3.9

The error
“mkdir: cannot create directory ‘/data’: Permission denied”
I cannot run OS commands

cmd = “mkdir -p {staging_path}”.format(staging_path=self.staging_path)
output = os.popen(cmd).read()

cmd = "rm -Rf {staging_path} ".format(staging_path=self.staging_path)
output = os.popen(cmd).read()

Regards.

Hi @migandhi

Have you tried doing this in a Pythonic way via os.mkdir() to create a directory and os.rmdir() to remove a directory.

os.mkdir is working , I did not try rmdir ,
ultimately the error must be
there was a leading /
like mkdir /data/tmp
the leading slash must be assuming root directory
I removed the leading slash from the path , mkdir data/tmp
I think the os commands will also work
Thanks,
Regards.

Awesome, great to hear that it is working. You can also use os.getcwd() to get the current working directory which you can prepend to the file name to get the file path.