Execute a shell command with Python

131 Views Asked by At

I'm trying to execute a shell command using Python's subprocess. This is how I do it:

pelican = 'pelican content -s /home/pelican/publishconf.pyt -D --ignore-cache'
subprocess.call(pelican, shell=True)

But the response is command not found. It doesn't have a problem when I write in my command line.

My question is how can I execute a shell command using python that behaves just like I would type it in?

0

There are 0 best solutions below