468,740 Members | 1,918 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,740 developers. It's quick & easy.

Shell: run script

Can someone tell me how to run a script from a interactive shell

I type the following:
python filename
python filename.py
run filename
run filename.py
/run filename
/run filename.py


and in all cases I get errors. I can't believe I can not run
a script from the shell.

What am I doing wrong?????

Help!!!!!!!!!
Jul 18 '05 #1
3 4542
"leroybt.rm" <le*****@rocketmail.com> schrieb im Newsbeitrag
news:ma*************************************@pytho n.org...
| Can someone tell me how to run a script from a interactive shell
|
| I type the following:
|
| >>>python filename
| >>>python filename.py
| >>>run filename
| >>>run filename.py
| >>>/run filename
| >>>/run filename.py
You want to run a script from *inside the Python Interactive Shell*? Or do
you want to run a Python script (*.py) as a program from any (other than the
Python shell)? Or did you mix these two things up?
Vincent Wehren



| and in all cases I get errors. I can't believe I can not run
| a script from the shell.
|
| What am I doing wrong?????
|
| Help!!!!!!!!!
|
|
Jul 18 '05 #2
On Wed, 26 Nov 2003 18:40:05 +0000, leroybt.rm wrote:
Can someone tell me how to run a script from a interactive shell

I type the following:
python filename
python filename.py
run filename
run filename.py
/run filename
/run filename.py


and in all cases I get errors. I can't believe I can not run
a script from the shell.


Normally, you do not want to run your scripts from a Python shell,
but from the bash etc. (Linux shells) or from a DOS console
(Windows) etc. For this, you use:

python <path_to_file>

If you really want to run a script from the Python shell, the
following will do:

execfile("<path_to_file>")

HTL, L.
--
mailto: logan@phreaker(NoSpam).net

Jul 18 '05 #3
Dnia Wed, 26 Nov 2003 18:40:05 -0000, leroybt.rm napisał(a):
Can someone tell me how to run a script from a interactive shell


You mean interactive session? If yes, then do:

import os
os.system('/path/to/a/script')

--
[ Wojtek Walczak - gminick (at) underground.org.pl ]
[ <http://gminick.linuxsecurity.pl/> ]
[ "...rozmaite zwroty, matowe od patyny dawnosci." ]

Jul 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Mohsin | last post: by
2 posts views Thread by ellennolan | last post: by
5 posts views Thread by Hul Tytus | last post: by
5 posts views Thread by inetquestion | last post: by
4 posts views Thread by devi thapa | last post: by
xarzu
2 posts views Thread by xarzu | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.