[IPython-user] Alias question

Dick Moores rdmoores@gmail....
Fri Jul 11 14:44:28 CDT 2008

On Fri, Jul 11, 2008 at 8:12 AM, Ville M. Vainio <vivainio@gmail.com> wrote:
> On Fri, Jul 11, 2008 at 5:28 AM, Dick Moores <rdmoores@gmail.com> wrote:
>> I'd like to know how to create an alias to run a script. I've tried
>> alias tri 'run e:\\PythonWork\\Turtle\\randomTriangles.py'
> You need to create macro for that. Aliases are just for system commands.

So I learned how to do that, and to store the macro (See p.18 of the manual).

But I also found that Ole is correct as well: his alias works, and if
stored, remains stored across sessions:

(I used a throwaway alias name, '875', before I remembered the
'unalias' command from my shell account days)

In [5]: alias 875 "python e:\\PythonWork\\Turtle\\randomTriangles.py"

In [6]: store 875
Alias stored: 875 (0, '"python

New session:

In [2]: alias
Total number of aliases: 10
[('cls', 'cls'),
 ('copy', 'copy'),
 ('echo', 'echo'),
 ('mkdir', 'mkdir'),
 ('ren', 'ren'),
 ('rmdir', 'rmdir'),
 ('875', '"python e:\\\\PythonWork\\\\Turtle\\\\randomTriangles.py"'),
 ('ddir', 'dir /ad /on'),
 ('ldir', 'dir /ad /on'),
 ('ls', 'dir /on')]

In [3]: 875
(program ran)

In [4]: unalias 875
Removing %stored alias 875

Thanks for the help!


More information about the IPython-user mailing list