473,395 Members | 1,348 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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 4905
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Mohsin | last post by:
Hi all, I have a perl program which makes a user exit to the O/S (unix, solaris) to issue a O/S command. I know that the shell it invokes is NOT a korn shell, because I captured the shell info...
3
by: FPGA05 | last post by:
Hello All, I am developing a small application in which I would need a C++ application to read the output from a shell script. A shell script keeps looking for user inputs and once the user...
6
by: Sanket80 | last post by:
Hi, I have one shell script which runs a report and sends the output to user. The shell script has some queries written in it in SQL and hence when I execute a shell script via a concurrent...
9
by: sohan | last post by:
Hi, I want to know how to connect and execute a db2 query from inside a UNIX shell script. Details: We have a unix shell script. We need to execute multiple db2 sql queries from this shell...
3
by: telduivel | last post by:
Can someone please help me with this: I have a python script, that at some point calls a linux bash script (.sh). Starting the shell script is the last thing my python script needs to do, so I...
2
by: ellennolan | last post by:
Hello, I wonder if anyone can help with calling external shell script in c++. Basically, in the shellscript, I want to pass src, dst, md5. If the src's md5 matches md5 given, it will be link to...
5
by: Hul Tytus | last post by:
comp.lang.c c programs & shell conditionals How is a unix shell script made to respond to the value returned by a program compiled from c code? The shell script below is my current effort,...
5
by: inetquestion | last post by:
I am looking for a web interface for shell commands or shell scripts. Does anyone know of any exexisting php scripts which would solve this requirement? PHP form accepts input from a user, then...
7
by: Samuel A. Falvo II | last post by:
I have a shell script script.sh that launches a Java process in the background using the &-operator, like so: #!/bin/bash java ... arguments here ... & In my Python code, I want to invoke...
4
by: devi thapa | last post by:
Hi, I am executing a python script in a shell script. The python script actually returns a value. So, can I get the return value in a shell script? If yes, then help me out. Regards, Devi
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.