Show hidden files
You can see them with os.listdir('./')
You can create them via the normal editor, try the + and give a name beginning with '.'
You can rename them via os.rename('.test.txt','test.txt')
You can remove them via os.remove('.test.txt')
Édit: sorry, not the hidden, the files beginning with a '.'
I’m talking about the Pythonista iOS UI. It doesn’t list those files on the left and so I can’t edit them.
@gee4vee we understood but gave ways to get them
JonB last edited by
As an example:
@gee4vee please, try this quick and dirty, select a file, it will be edited
import ui import editor import os class MyTableViewDelegate (object): def tableview_did_select(tableview, section, row): # Called when a row was selected. editor.open_file(tableview.data_source.items[row], new_tab=True) tableview.close() tv = ui.TableView() path = './' files =  for file in os.listdir(path): if not os.path.isdir(path + file): files.append(file) files.sort() tv.data_source = ui.ListDataSource(items=files) tv.delegate = MyTableViewDelegate tv.present()
@JonB sorry, we crossed our posts
@gee4vee in my little script, you could really delete the file (without confirmation) by swiping left, if you add these lines before tv.present()
def Mytableview_delete(tableview, section, row): # Called when the user confirms deletion of the given row. os.remove(tableview.data_source.items[row]) del tableview.data_source.items[row] tv.data_source.tableview_delete = Mytableview_delete
brumm last edited by
gee4vee last edited by gee4vee
Hmm I guess I’m not using Pythonista the way you guys are. I’m just using it as a code editor. How can I make Pythonista use that code you’re providing in its UI? You mean I can alter its code at runtime?
I need to edit these pretty regularly and they cannot be renamed.
I don't understand why and how hou have these hidden files in Pythonista.
Please explain and perhaps we could help you
I am loading an external folder that was created with Working Copy. The source code repository has files that begin with a dot and those are pretty common for many kinds of source code repositories.
JonB last edited by JonB
If you create a script, then tap the little wrench icon, you can add new shortcuts to the wrench menu. That let's you keep useful scripts, such as the filenav, available at all times. Of course you can also just open a script, and press "play" -- pythonista is more than just an editor, it is a full featured python interpreter.
You can also run code from the console (swipe left from editor), for instance my one liner (actually two lines, since you would need to import editor first). The console won't let you paste multiple lines, so that is less useful for copying code from the forum.
Many people find
stashto be very useful.
See the install section for a one liner that you can paste to the console and run.
Then, when you run stash, you get a bash-like shell, which does allow you to use
editto launch the editor with any file you can find. Stash also has many useful commands that you might expect in a shell, you can mv files, use wget to download, it has some tar, zip, ssh, ftp, git support (albeit limited), also iirc some smb support.
@JonB thanks so much! Will try stash. I understand now.