##// END OF EJS Templates
implement %run myscript.ipy
vivainio -
Show More
@@ -0,0 +1,15 b''
1 import os
2
3
4 editor = r'q:/opt/np/notepad++.exe'
5
6
7 e = os.environ
8
9 e['EDITOR'] = editor
10 e['VISUAL'] = editor
11
12
13
14
15
@@ -1,7 +1,7 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """Magic functions for InteractiveShell.
2 """Magic functions for InteractiveShell.
3
3
4 $Id: Magic.py 1962 2006-12-05 21:08:50Z vivainio $"""
4 $Id: Magic.py 1981 2006-12-12 21:51:54Z vivainio $"""
5
5
6 #*****************************************************************************
6 #*****************************************************************************
7 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
7 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
@@ -1375,7 +1375,7 b' Currently the magic system has the following functions:\\n"""'
1375
1375
1376 Usage:\\
1376 Usage:\\
1377 %run [-n -i -t [-N<N>] -d [-b<N>] -p [profile options]] file [args]
1377 %run [-n -i -t [-N<N>] -d [-b<N>] -p [profile options]] file [args]
1378
1378
1379 Parameters after the filename are passed as command-line arguments to
1379 Parameters after the filename are passed as command-line arguments to
1380 the program (put in sys.argv). Then, control returns to IPython's
1380 the program (put in sys.argv). Then, control returns to IPython's
1381 prompt.
1381 prompt.
@@ -1472,7 +1472,12 b' Currently the magic system has the following functions:\\n"""'
1472 where the profiler executes them).
1472 where the profiler executes them).
1473
1473
1474 Internally this triggers a call to %prun, see its documentation for
1474 Internally this triggers a call to %prun, see its documentation for
1475 details on the options available specifically for profiling."""
1475 details on the options available specifically for profiling.
1476
1477 There is one special usage for which the text above doesn't apply:
1478 if the filename ends with .ipy, the file is run as ipython script,
1479 just as if the commands were written on IPython prompt.
1480 """
1476
1481
1477 # get arguments and set sys.argv for program to be run.
1482 # get arguments and set sys.argv for program to be run.
1478 opts,arg_lst = self.parse_options(parameter_s,'nidtN:b:pD:l:rs:T:e',
1483 opts,arg_lst = self.parse_options(parameter_s,'nidtN:b:pD:l:rs:T:e',
@@ -1488,6 +1493,10 b' Currently the magic system has the following functions:\\n"""'
1488 error(msg)
1493 error(msg)
1489 return
1494 return
1490
1495
1496 if filename.lower().endswith('.ipy'):
1497 self.api.runlines(open(filename).read())
1498 return
1499
1491 # Control the response to exit() calls made by the script being run
1500 # Control the response to exit() calls made by the script being run
1492 exit_ignore = opts.has_key('e')
1501 exit_ignore = opts.has_key('e')
1493
1502
@@ -7,6 +7,10 b''
7 * UserConfig/ipy_user_conf.py, UserConfig/ipythonrc:
7 * UserConfig/ipy_user_conf.py, UserConfig/ipythonrc:
8 Add deprecation note to ipythonrc and a url to wiki
8 Add deprecation note to ipythonrc and a url to wiki
9 in ipy_user_conf.py
9 in ipy_user_conf.py
10
11 * Magic.py (%run): %run myscript.ipy now runs myscript.ipy
12 as if it was typed on IPython command prompt, i.e.
13 as IPython script.
10
14
11 2006-12-08 Ville Vainio <vivainio@gmail.com>
15 2006-12-08 Ville Vainio <vivainio@gmail.com>
12
16
General Comments 0
You need to be logged in to leave comments. Login now