##// END OF EJS Templates
Backport PR #2102: Fix logging on interactive shell....
Backport PR #2102: Fix logging on interactive shell. Add a missing string format code in init_logs() and move init_logstart() after init_magics(), to fix dependency issues. This is a proposed fix for the case a log file is given in `ipython_config.py`, eg: ```python # Start logging to the given file in append mode. import os from time import strftime f = os.path.join(c.TerminalIPythonApp.ipython_dir, strftime('%Y-%m-%d')+".py") c.TerminalInteractiveShell.logappend = f ``` which completely breaks in current `master` code

File last commit:

r4872:34c10438
r7990:a4d72683
Show More
win32clip.py
45 lines | 1.1 KiB | text/x-python | PythonLexer
Brian Granger
ipapi.py => core/ipapi.py and imports updated.
r2027 from IPython.core import ipapi
fperez
Fix win32 line endings.
r281
Brian Granger
ipapi.py => core/ipapi.py and imports updated.
r2027 ip = ipapi.get()
fperez
Fix win32 line endings.
r281
def clip_f( self, parameter_s = '' ):
"""Save a set of lines to the clipboard.
Usage:\\
%clip n1-n2 n3-n4 ... n5 .. n6 ...
This function uses the same syntax as %macro for line extraction, but
instead of creating a macro it saves the resulting string to the
clipboard.
Bernardo B. Marques
remove all trailling spaces
r4872
When used without arguments, this returns the text contents of the clipboard.
fperez
Fix win32 line endings.
r281 E.g.
Bernardo B. Marques
remove all trailling spaces
r4872
fperez
Fix win32 line endings.
r281 mytext = %clip
Bernardo B. Marques
remove all trailling spaces
r4872
fperez
Fix win32 line endings.
r281 """
import win32clipboard as cl
import win32con
args = parameter_s.split()
cl.OpenClipboard()
if len( args ) == 0:
data = cl.GetClipboardData( win32con.CF_TEXT )
cl.CloseClipboard()
return data
api = self.getapi()
Bernardo B. Marques
remove all trailling spaces
r4872
fperez
Fix win32 line endings.
r281 if parameter_s.lstrip().startswith('='):
rest = parameter_s[parameter_s.index('=')+1:].strip()
val = str(api.ev(rest))
else:
ranges = args[0:]
val = ''.join( self.extract_input_slices( ranges ) )
cl.EmptyClipboard()
cl.SetClipboardText( val )
cl.CloseClipboard()
print 'The following text was written to the clipboard'
print val
Bernardo B. Marques
remove all trailling spaces
r4872
Brian Granger
Continuing a massive refactor of everything.
r2205 ip.define_magic( "clip", clip_f )