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.
Editor Module Question
-
Hey all, quick question about the editor module here. For the .openfile() function, it gives me an error when I put the name of the file I want to open. After reading on the forum, it says to use the filepath. As much as I tried to find a way, I’ve not been able to get the filepath. The file is just in a folder called Brain. Thanks in advance.
-
import os
os.path.expanduser('~/Documents/Brain/yourfile.txt') -
@procryon, my example is same as @JonB , except I just split it up so you see the root dir for Pythonista etc. Functionally the same. Just more step by step
import os _root_path = os.path.expanduser('~/Documents') _my_dir = 'Brain' _my_file_name = 'yourfile.txt' my_path = os.path.join(_root_path, _my_dir, _my_file_name) print(my_path) with open(my_path, "w") as f: f.writelines("Hello World")