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


Groups > comp.lang.python > #33690

Re: Problem with subprocess.call and windows schtasks

Date 2012-11-20 20:28 -0500
From Dave Angel <d@davea.name>
Subject Re: Problem with subprocess.call and windows schtasks
References <CAAPnF_W4XWNLzC=qaAjsHF8MDY574x6UA=ewE3Jw=ZksvnXjJg@mail.gmail.com> <CAMZYqRRJsMtQQVkkH7quQGsrmsWmtQhaNLR9t5_eD7pdrmRq3w@mail.gmail.com> <CAAPnF_Ws4AKwFViG6ks=fqAzEfDdW4nRBu+g6Uk6KG9YePwVgA@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.122.1353461335.29569.python-list@python.org> (permalink)

Show all headers | View raw


On 11/20/2012 06:41 PM, Tom Borkin wrote:

(Please don't top-post.  Now we lose all the context)
> Using shlex, I now have this:
> #!\Python27\python
> import os, subprocess
> path = os.path.join("C:\\", "Program Files", "Apache Group", "Apache2",
> "htdocs", "ccc", "run_alert.py")
> #subprocess.call(['SchTasks', '/Create', '/SC', 'ONCE', '/TN', '"test"',
> '/TR', path, '/ST', '23:50'])
> subprocess.call(['SchTasks', '/Create', '/SC', 'ONCE', '/TN', '"test"',
> '/TR', 'run_alert.py', '/ST', '23:50'])
> Both of the above commands throw the same error:
> ERROR: The filename, directory name or volume label syntax is incorrect.

I don't use Windows, but doesn't a Windows program usually have an .exe
extension?  So why would you expect it to find SchTasks ?  Adding
extensions is a shell feature, and you're not using the shell.

Also, you should take a look at the value "path".  On Linux, it shows up as:

C:\\/Program Files/Apache Group/Apache2/htdocs/ccc/run_alert.py

It'll be different under Windows, but probably still wrong.


-- 

DaveA

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Problem with subprocess.call and windows schtasks Dave Angel <d@davea.name> - 2012-11-20 20:28 -0500

csiph-web