User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Python section within the Software Development category of DaniWeb, a massive community of 403,516 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,867 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Python advertiser: Programming Forums
Views: 270 | Replies: 1
Reply
Join Date: Jun 2008
Posts: 8
Reputation: elhallouf is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
elhallouf elhallouf is offline Offline
Newbie Poster

Call a shell script from a python script

  #1  
Jul 17th, 2008
Hey you all

I have a simple question :

How do we call a shell script from a python script ? (Windows)

I tried this :
import os
os.system('sh C:\temp\script.sh')

and this :
import subprocess
subprocess.call("C:\temp\script.sh",shell=True)

I played with the sh, adding it, removing it, adding .exe
I played with the slashes ..

I couldn't get this work

Thanks
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jul 2008
Location: Durham, NC
Posts: 139
Reputation: jlm699 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 21
jlm699's Avatar
jlm699 jlm699 is offline Offline
Junior Poster

Re: Call a shell script from a python script

  #2  
Jul 17th, 2008
if you can type exactly that command into your command window, then os.system() with *exactly* that command will work.

What doesn't work about it? Are you getting an error?
Let's Go Pens!
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Python Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Python Forum

All times are GMT -4. The time now is 1:04 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC