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.
File Browser question
-
@Matteo Every directory contains a . and a .. entry. (in Unix, Windows, etc...)
. means the directory itself. It is called the current directory.
.. means the directory's parent directory, that is, the directory that contains it.
-
@Matteo to delete the file at end of your script
Import os os.remove(folder_path+'.folder.py')
-
@Matteo I think that it is not "magically". When you run a script, Pythonista opens its folder, thus...
-
@cvp Hi , thank you for reply: 'magically' because in previous posts we read that omz solution works only in version 3.2, when I run it in v3.1 I obtain a blank folder, even if I'm sure I have some files inside it.
After my last post I can open any folder programmatically also in v3.1 (it is not elegant because the solution I found needs to create a new file inside the folder where I want to go with file browser and in order to not see it I must hide it with a dot at the beginning of filename).
Thank you also for deleting hint, unfortunately when I add:
import os os.remove(folder_path + '.folder.py')
after
webbrowser.open('pythonista://my-folder_01/my-folder_11/my-folder_12/.folder.py?action=run')
of script 'A', the script doesn't work as expected, because it deletes the file '.folder.py' even before that the istruction
webbrowser.open('pythonista://my-folder_01/my-folder_11/my-folder_12/.folder.py?action=run')
is executed.
Have you some other ideas about deleting a file named 'B' after a webbrowser.open use that needs the file 'B'?
Thank you
Bye -
@Matteo The script of omz did open a folder, your script runs a script, that makes the magic difference.
Put a little sleep after webbrowser.open to let it time to perform its action before the remove
import time time.sleep(0.2)
-
@cvp It works! Thank you, sometimes sleeping is good, also for a code ;-)
Bye -
@Matteo Surely when the work is done during your sleep 😂