473,288 Members | 1,705 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,288 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 4896
"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
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...

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.