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.


    Pythonista Root Dir - 'Documents' is static or language dependent ?

    Pythonista
    home documents dir root language
    2
    5
    5084
    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.
    • Phuket2
      Phuket2 last edited by Phuket2

      Firstly I assume to get the root or home dir for Pythonista you do:
      os.path.expanduser('~') + '/Documents/'

      I think that's correct anyway.

      my question is, is 'Documents' static across all languages and including double byte such as Japanese etc?

      @omz should we allow in our scripts that this could change in the future? maybe there is a better way to get the root/home dir rather than appending 'Documents' to expanduser.

      Edit: I should have asked the same questions about the site-packages dir

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

        @omz, Ok, after all that crap.i am guessing the exact right way should be via another Pythonista specific module environment/paths or something like that. So anything you may change in the future is easily handled inside your module. Well, it's the conclusion I have come too after a few more whiskeys anyway. As well as double byte system issues etc

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

          The internal directory structure is not locale-/language-dependent. It'll always be Documents, though that's a (conventional) name I chose, and it could theoretically be something else.

          I'd recommend to use expanduser() with the full path instead of adding '/Documents/' afterwards:

          os.path.expanduser('~/Documents/')

          In general, if you want to concatenate two paths, it's usually better to use os.path.join() instead of +.

          Phuket2 2 Replies Last reply Reply Quote 0
          • Phuket2
            Phuket2 @omz last edited by

            @omz , sorry we just missed each on our posts 😬

            1 Reply Last reply Reply Quote 1
            • Phuket2
              Phuket2 @omz last edited by Phuket2

              @omz , just when you thought I couldn't be anymore annoying 😁
              Sorry one thing more to mention.
              I think it would be nice if in the site-packages directory, you had another directory called something like 'App Files' or 'Config' or something like that. And then by convention apps that are saving config info , create a directory inside your special folder and store their app specific config info inside their folder.

              Just as a convention, they don't have to of course

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