Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #33505 > unrolled thread

Re: Problem with subprocess.call and windows schtasks

Started byTim Golden <mail@timgolden.me.uk>
First post2012-11-18 16:19 +0000
Last post2012-11-18 16:19 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Problem with subprocess.call and windows schtasks Tim Golden <mail@timgolden.me.uk> - 2012-11-18 16:19 +0000

#33505 — Re: Problem with subprocess.call and windows schtasks

FromTim Golden <mail@timgolden.me.uk>
Date2012-11-18 16:19 +0000
SubjectRe: Problem with subprocess.call and windows schtasks
Message-ID<mailman.3794.1353255571.27098.python-list@python.org>
On 18/11/2012 13:48, Tom Borkin wrote:
> import subprocess
> #subprocess.call(['SchTasks /Create /SC ONCE /TN "My Tasks" /TR "C:/Program
> Files/Apache Group/Apache2/htdocs/ccc/run_alert.py" /ST 07:50'], shell=True)
> subprocess.call(['SchTasks /Create /SC ONCE /TN "test" /TR "run_alert.py"
> /ST 07:50'], shell=True)
> With either call, I get this error:
> C:\Program Files\Apache Group\Apache2\htdocs\ccc>cron_alert_activity.py
> The system cannot find the path specified.

Generally, with subprocess call:

* Pass each element in the command line as a separate element in the 
list: ['SchTasks', '/Create', '/SC', 'ONCE', ... &c.]

* Don't use shell=True unless you're running a command which is internal 
to cmd.exe (such as dir, copy, etc.). If you're running anything which 
exists as its own .exe, you shouldn't be using shell=True.

TJG

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web