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.
Sorry if this is obvious... but is there an easy way to export everything in the shell/console to a text file?
-
Hey guys,
This seems like it should be obvious, but I can't figure it out. After playing around in the console, is there an easy way to dump all of the output into a text file for later viewing? As of right now, I'm selecting all-> copy -> new plaint text file -> paste, but that just feels silly.
What am I missing here?
-
-
The question is a little different, since he already has written to the console, and NOW wants to save it. Technically this can be done in 3 lines, so qualifies for ccc's ten lines or less....
though i broke up the long string of method calls onto multiple lines to keep some semblance of readability.This is my
save_session
script which appends to a command history file ( making it easier to convert an interactive session into a real script), and writes the current console output to a new file. Feel free to adapt to your own needs.from objc_util import UIApplication from time import ctime # save history with open('history.py','a') as f: f.write(ctime()+'\n') f.write( '\n'.join([str(h) for h in UIApplication.sharedApplication().keyWindow(). rootViewController().accessoryViewController(). consoleViewController().history() ])+'\n') #save console output with open('console_history.txt','w') as f: f.write(ctime()+'\n') f.write(str( UIApplication.sharedApplication(). keyWindow().rootViewController(). accessoryViewController().consoleViewController(). consoleOutputTextView().text() ))