RE: Problem with subprocess.call and windows schtasks

Discussion in 'Python' started by Prasad, Ramit, Nov 23, 2012.

  1. 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.
     
    Prasad, Ramit, Nov 23, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. cct

    schtasks problem

    cct, Nov 12, 2003, in forum: ASP .Net Security
    Replies:
    0
    Views:
    180
  2. Tim Golden
    Replies:
    0
    Views:
    179
    Tim Golden
    Nov 18, 2012
  3. Chris Rebert
    Replies:
    0
    Views:
    219
    Chris Rebert
    Nov 18, 2012
  4. Dave Angel
    Replies:
    0
    Views:
    188
    Dave Angel
    Nov 21, 2012
  5. Tim Golden
    Replies:
    0
    Views:
    134
    Tim Golden
    Nov 21, 2012
Loading...

Share This Page