473,406 Members | 2,312 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,406 software developers and data experts.

how to execute shell script using python scripts

I have a shell file in location
/home/transfer/check.sh

I need to excecute this shell file using python script
Apr 24 '12 #1
4 2167
Smygis
126 100+
There is a module called subprocess. Look in to in.
May 5 '12 #2
Pfft... hate it when people post RTFM.
If you just want a simple IO on the script file try

Expand|Select|Wrap|Line Numbers
  1. import commands
  2.  
  3. output = commands.getstatusoutput('/home/transfer/check.sh')
  4.  
That will return back a tupple of the return code and the string output to console.
If thats not quite right, you can check the commands module or if you need even more leverage with the console there is the module subprocess.

Edit: That is assuming you banged your shell script. If not you will have to change that to '/bin/sh /home/transfer/check.sh' OR just bang the script and give it execute permission.
May 30 '12 #3
dwblas
626 Expert 512MB
We generally don't anwser questions that can be easily found with a Google http://www.google.com/search?client=...hannel=suggest because that indicates that the person is just lazy.
May 31 '12 #4
dwblas
626 Expert 512MB
I like Doug Hellmann's explanation of subprocess.
May 31 '12 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Aashif | last post by:
I want to call Unix Shell script which is available in other Server (Unix server) from windows application using C#. Currently the shell script runs the C program but the GUI is not good, So I want...
20
by: Ramdas | last post by:
How do I add users using Python scripts on a Linux machine? Someone has a script?
2
by: mesum98 | last post by:
Hi, I have a python script which creates a csv file using following method def printOutInformation(self): if self.orderby == 'r': ...
3
by: yogesh_anand | last post by:
Hi I am running one shell script from my application process which is running on sun solaris platform. If i run script suppose as "oracle" user then its successfully execute within process. ...
1
by: GnanaKumar | last post by:
hi, Can any one explain me how to execute COBOL program using Python scripts... do i need any third party tool to do this.. can you pls help me out regards, Gnana Kumar
0
by: P. Adhia | last post by:
Hello, I was wondering if anyone is successfully using using Python(2.5)+DB2+pydb2. I get an error in all situations. It seems that this problem might be limited to python 2.5. A quick Google...
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...
0
by: shaheda begum | last post by:
Hi everyone, Can anyone guide me how to link archive file(libxyssl.a) to my shell script( .sh file) in Perl using swig interface. Thank you in advance.
3
by: BibhuAshish | last post by:
Hi, I have a button. I want to run a shell script when i click that button. My HTML code is given below: <html> <head> </head> <body> <input type = "button" value = "run script" onclick =...
3
by: xtremebass | last post by:
Hi , I am want to run the shell script to run every 10 minutes of interval ,so that i have used crontab command for scheduling the shell script .. it cant works . i have checked wall command in...
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: 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: 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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.