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

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <d@davea.name>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'syntax': 0.03; 'error:': 0.05; 'linux,': 0.05; 'subject:skip:s 10': 0.05; 'tom': 0.07; 'filename,': 0.09; 'path,': 0.09; 'throw': 0.09; 'windows,': 0.09; 'cc:addr:python-list': 0.10; 'extensions': 0.13; 'skip:# 20': 0.13; 'subject:Problem': 0.16; 'subject:windows': 0.16; 'subprocess': 0.16; 'wrote:': 0.17; 'shell': 0.18; 'windows': 0.19; 'import': 0.21; 'os,': 0.22; 'this:': 0.23; 'cc:no real name:2**0': 0.24; 'cc:2**1': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'skip:# 10': 0.27; 'label': 0.27; "doesn't": 0.28; 'feature,': 0.29; 'probably': 0.29; "skip:' 10": 0.30; 'usually': 0.30; 'expect': 0.31; 'path': 0.35; 'pm,': 0.35; 'but': 0.36; 'skip:g 30': 0.36; 'subject:with': 0.36; 'should': 0.36; 'why': 0.37; 'subject:: ': 0.38; 'skip:o 20': 0.38; 'shows': 0.38; 'received:192': 0.39; 'skip:" 10': 0.40; 'received:192.168': 0.40; 'different': 0.63; 'header:Reply-To:1': 0.68; 'lose': 0.71; 'received:74.208': 0.71; 'reply-to:no real name:2**0': 0.72; 'as:': 0.75; 'received:74.208.4.194': 0.84
Date Tue, 20 Nov 2012 20:28:24 -0500
From Dave Angel <d@davea.name>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121011 Thunderbird/16.0.1
MIME-Version 1.0
To Tom Borkin <borkintom@gmail.com>
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>
In-Reply-To <CAAPnF_Ws4AKwFViG6ks=fqAzEfDdW4nRBu+g6Uk6KG9YePwVgA@mail.gmail.com>
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 7bit
X-Provags-ID V02:K0:1l/sVMa1uJP62Kgcnh6Yk419hSWcLLj3ljn7IvvL7g3 fR7sETIFVgFEfKc3QXkAvi+Ck4xu+V7JEPoAfu3WeAp0sFeN+3 oCh7MksC5BSlLP8VWBNdSBV6UU4zSQJDdlKR08vDekDCdA/Ybg GhXecKrkqqCEctI/OPa1/rQim5emxaQDohPlFgLRLcx/HO7glg NLceuBWxIcJYT+nLf16TearuBlZSynaRlTkY+VeZmcymfnCGVa /6IQnDks7N43UbO+4DBPGCRYCfJgK0QOr17OOdEVTbFKuC13z9 hfyk7SNbAFGfOKnKjYSsLDlfookt+U6M9ZhjUPbHnaURUOopg= =
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
Reply-To d@davea.name
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.122.1353461335.29569.python-list@python.org> (permalink)
Lines 30
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1353461335 news.xs4all.nl 6890 [2001:888:2000:d::a6]:36397
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:33690

Show key headers only | 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