Re: Problem with subprocess.call and windows schtasks

Discussion in 'Python' started by Dave Angel, Nov 21, 2012.

  1. Dave Angel

    Dave Angel Guest

    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
    Dave Angel, Nov 21, 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:
    167
  2. Tim Golden
    Replies:
    0
    Views:
    175
    Tim Golden
    Nov 18, 2012
  3. Chris Rebert
    Replies:
    0
    Views:
    214
    Chris Rebert
    Nov 18, 2012
  4. Tim Golden
    Replies:
    0
    Views:
    130
    Tim Golden
    Nov 21, 2012
  5. Prasad, Ramit
    Replies:
    0
    Views:
    162
    Prasad, Ramit
    Nov 23, 2012
Loading...

Share This Page