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


Groups > comp.lang.python > #33870

RE: Problem with subprocess.call and windows schtasks

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder7.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ramit.prasad@jpmorgan.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'syntax': 0.03; 'error:': 0.05; 'linux,': 0.05; 'subject:skip:s 10': 0.05; 'completeness': 0.07; 'tom': 0.07; 'python': 0.09; 'filename,': 0.09; 'path,': 0.09; 'received:155': 0.09; 'throw': 0.09; 'windows,': 0.09; 'cc:addr:python-list': 0.10; 'extensions': 0.13; 'skip:# 20': 0.13; 'disclaimers': 0.16; 'disclaimers,': 0.16; 'from:addr:jpmorgan.com': 0.16; 'received:155.180': 0.16; 'received:155.180.234': 0.16; 'received:155.180.234.122': 0.16; 'received:159.53': 0.16; 'received:159.53.110': 0.16; 'received:159.53.110.174': 0.16; 'received:bankone.net': 0.16; 'received:exchad.jpmchase.net': 0.16; 'received:jpmchase.com': 0.16; 'received:jpmchase.net': 0.16; 'received:se3.svr.bankone.net': 0.16; 'received:sj2.jpmchase.com': 0.16; 'received:svr.bankone.net': 0.16; 'securities,': 0.16; 'subject:Problem': 0.16; 'subject:windows': 0.16; 'subprocess': 0.16; 'url:disclosures': 0.16; 'url:jpmorgan': 0.16; 'wrote:': 0.17; 'skip:g 40': 0.17; 'shell': 0.18; '>>>': 0.18; 'windows': 0.19; 'import': 0.21; 'os,': 0.22; 'cc:2**0': 0.23; 'this:': 0.23; 'received:169.254': 0.24; 'cc:addr:python.org': 0.25; 'header:In- Reply-To:1': 0.25; 'skip:# 10': 0.27; '2.6': 0.27; 'accuracy': 0.27; 'label': 0.27; "doesn't": 0.28; 'feature,': 0.29; 'received:169': 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; 'charset:us-ascii': 0.36; 'why': 0.37; 'subject:: ': 0.38; 'skip:o 20': 0.38; 'shows': 0.38; 'skip:" 10': 0.40; 'different': 0.63; 'information,': 0.63; 'url:email': 0.63; 'legal': 0.65; 'subject': 0.66; 'purchase': 0.67; 'lose': 0.71; 'as:': 0.75; 'sale': 0.76; 'received:169.254.8': 0.84; 'angel': 0.93
X-DKIM OpenDKIM Filter v2.1.3 sj2.jpmchase.com qANMWtDr025913
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=jpmorgan.com; s=smtpout; t=1353709976; bh=TT4NAX+IU7kb5zexzy9mgLko3fSo8RzY3kKGdHxvaiA=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Transfer-Encoding:MIME-Version:Content-Type; b=MZDtbGhst1yZ23nn+vJ9DJE/M3pw+KHsBGs7UCrdurWOzfJMAfr2sEYJgURdrajj0 cBFTuhAJ8EJ+R5+Uz0SJ+bZefvCcVNq5FtbVTrPduZbqeL68G7hvDcqlwtsda8wuFn jSqCQGhquATSdvrMAchOLXWYrQl605dWYfXfGMls=
From "Prasad, Ramit" <ramit.prasad@jpmorgan.com>
To Tom Borkin <borkintom@gmail.com>
Subject RE: Problem with subprocess.call and windows schtasks
Thread-Topic Problem with subprocess.call and windows schtasks
Thread-Index AQHNxZNoB34Z+hDZRU+m6JnyCo/OmJfwHzeAgAOaowCAAB3QAIAEMdEA
Date Fri, 23 Nov 2012 22:32:48 +0000
References <CAAPnF_W4XWNLzC=qaAjsHF8MDY574x6UA=ewE3Jw=ZksvnXjJg@mail.gmail.com> <CAMZYqRRJsMtQQVkkH7quQGsrmsWmtQhaNLR9t5_eD7pdrmRq3w@mail.gmail.com> <CAAPnF_Ws4AKwFViG6ks=fqAzEfDdW4nRBu+g6Uk6KG9YePwVgA@mail.gmail.com> <50AC2E38.8050303@davea.name>
In-Reply-To <50AC2E38.8050303@davea.name>
Accept-Language en-US
Content-Language en-US
X-MS-Has-Attach
X-MS-TNEF-Correlator
x-originating-ip [10.67.79.47]
Content-Transfer-Encoding quoted-printable
MIME-Version 1.0
X-DLP-FWD Yes
Content-Type text/plain; charset="us-ascii"
Cc "python-list@python.org" <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
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.246.1353709985.29569.python-list@python.org> (permalink)
Lines 26
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1353709985 news.xs4all.nl 6854 [2001:888:2000:d::a6]:49104
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:33870

Show key headers only | View raw


Dave Angel wrote:
> 
> 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.

Windows 7 + Python 2.6
>>> os.path.join("C:\\", "Program Files", "Apache Group", "Apache2",
...  "htdocs", "ccc", "run_alert.py")
'C:\\Program Files\\Apache Group\\Apache2\\htdocs\\ccc\\run_alert.py'


~Ramit


This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.  

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


Thread

RE: Problem with subprocess.call and windows schtasks "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-11-23 22:32 +0000

csiph-web