Dick Moores | 11 Jul 04:27

Alias question

Win XP, Python 2.5.1

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'

But
In [162]: tri
'run' is not recognized as an internal or external command,
operable program or batch file.

Is there a way?

Thanks,

Dick Moores
Ole Trenner | 11 Jul 13:22

Re: Alias question

Dick Moores 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'

I'm not sure if this is bad or something, but it works:

In [1]: alias test "python e:\\test.py"

In [2]: test
in test.py

(test.py just does "print 'in test.py'")

Cheers,
Ole.

--

-- 
Ole Trenner
<ole <at> jayotee.de>
Ville M. Vainio | 11 Jul 17:12

Re: Alias question

On Fri, Jul 11, 2008 at 5:28 AM, Dick Moores <rdmoores <at> 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.

--

-- 
Ville M. Vainio - vivainio.googlepages.com
blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio'
Dick Moores | 11 Jul 21:44

Re: Alias question

On Fri, Jul 11, 2008 at 8:12 AM, Ville M. Vainio <vivainio <at> gmail.com> wrote:
> On Fri, Jul 11, 2008 at 5:28 AM, Dick Moores <rdmoores <at> 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
e:\\\\PythonWork\\\\Turtle\\\\randomTriangles.py"')

New session:

In [2]: alias
Total number of aliases: 10
Out[2]:
[('cls', 'cls'),
 ('copy', 'copy'),
 ('echo', 'echo'),
(Continue reading)


Gmane