Question: Is it possible to create folders in a fly volume via code?

I find my code is not able to create folders in a fly /data volume.

  • I would like to know if this is the default?

In addition to that, if this is not the default:

  1. Is it correct to save my file to /data/folder_that_my_code_creates/data.ext?
  2. With a code like
    with open("/data/folder_that_my_code_creates/data.ext") as f:
    f.write('')

Thanks

Try running os.mkdirs or pathlib.Path().mkdir first. Both support exist_ok=True in modern versons of Python. For older versions of python catch OSError and ignore errno.EEXIST.

Thanks, checking that out

I fixed the issue

  1. I was able to see my created folder per region but found out it was of file type using stat filename
  2. I used rm file to remove it from the diff regions
  3. I implemented my code to create a directory with the os.mkdirs
  4. It worked

As well worth it to note that my mkdirs was buggy as well and checking that the paths were files or folders helped as well

Thanks for the help.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.