Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > RE: Problem with subprocess.call and windows schtasks

Reply
Thread Tools

RE: Problem with subprocess.call and windows schtasks

 
 
Prasad, Ramit
Guest
Posts: n/a
 
      11-23-2012
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 throwthe same error:
> > ERROR: The filename, directory name or volume label syntax is incorrect.

>
> I don't use Windows, but doesn't aWindows program usually have an .exe
> extension? So why would youexpect 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 andsubject 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 entitydisclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Problem with subprocess.call and windows schtasks Tim Golden Python 0 11-21-2012 10:01 AM
Re: Problem with subprocess.call and windows schtasks Dave Angel Python 0 11-21-2012 01:28 AM
Re: Problem with subprocess.call and windows schtasks Chris Rebert Python 0 11-18-2012 04:39 PM
Re: Problem with subprocess.call and windows schtasks Tim Golden Python 0 11-18-2012 04:19 PM
schtasks problem cct ASP .Net Security 0 11-12-2003 08:23 AM



Advertisments