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 ?
-
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
-
@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
-
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+
. -
@omz , sorry we just missed each on our posts 😬
-
@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