replacing batch file with python script

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • SeeBelow@SeeBelow.Nut

    replacing batch file with python script

    I have not been able to find a simple way to have a python script
    execute an MS-DOS program repeatedly. execv(), for example, won't run
    it more than once. I have been using many lines of a .bat file, like
    so:

    ..
    ..
    ..
    del xyz
    myexec 1 2
    del xyz
    myexec 1 2
    ..
    ..
    ..

    where myexec is an executable program that I want to run many times. I
    would like to replace the repeated batch file lines with a python loop.
    There must be an easy way to do that, no? else why is Python called a
    scripting language.

    Thanks

    Mitchell Timin

    --
    In theory, there is no difference between theory and practice. In
    practice, there is.

    http://annevolve.sourceforge.net is what I was into until recently. My
    interest will revive when someone takes up my "SailChallenge" .
    Humans may write to me at this address: zenguy at shaw dot ca
  • Sridhar  R

    #2
    Re: replacing batch file with python script

    Don't use exec family of functions. Use os.system.

    Comment

    • SeeBelow@SeeBelow.Nut

      #3
      Re: replacing batch file with python script

      Sridhar R wrote:[color=blue]
      >
      > Don't use exec family of functions. Use os.system.[/color]

      Thanks, that seems to do what I want.

      m

      --
      In theory, there is no difference between theory and practice. In
      practice, there is.

      http://annevolve.sourceforge.net is what I was into until recently. My
      interest will revive when someone takes up my "SailChallenge" .
      Humans may write to me at this address: zenguy at shaw dot ca

      Comment

      • Ivo Woltring

        #4
        Re: replacing batch file with python script

        "Sridhar R" <sridharinfinit y@gmail.com> wrote in message news:<109884080 5.325388.93690@ z14g2000cwz.goo glegroups.com>. ..[color=blue]
        > Don't use exec family of functions. Use os.system.[/color]

        Also consider os.popen

        Comment

        Working...