472,954 Members | 1,675 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,954 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 4862
"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: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
1
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.