omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    os.makedirs related problem

    Pythonista
    2
    4
    1499
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • arikontiainen
      arikontiainen last edited by

      I’m stuck with creating a directory with code below with Python 3.6 in Pythonista. I seem to get OSError every single time. Any guesses why?

      try:
          os.makedirs(temp_label_path, mode=0o777, exist_ok=True)
      except OSError as e:
          sys.exit("\nCan't create {dir}: {err}".format(dir=temp_label_path, err=e))
      

      Where temp_label_path in my iPad is:
      /private/var/mobile/Containers/Data/Application/9A1B62CB-9238-4CF8-9A2E-AFE1A2A2457B/tmp/ari_temp/images/supi02

      cvp 1 Reply Last reply Reply Quote 0
      • cvp
        cvp @arikontiainen last edited by

        @arikontiainen this path is not in Pythonista Files, thus you can't create a file/folder there

        1 Reply Last reply Reply Quote 0
        • arikontiainen
          arikontiainen last edited by arikontiainen

          @cvp Ok, that is good to know. Thanks.

          What would be a correct way to create a temp directory, in which I could create folders and store files? I used

          tempfile.gettempdir()
          

          to get a starting point.

          cvp 1 Reply Last reply Reply Quote 0
          • cvp
            cvp @arikontiainen last edited by

            @arikontiainen I've created (manually šŸ˜€) a permanent temp directory for temporary files

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            Powered by NodeBB Forums | Contributors