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

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?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.