running an exe file from a python script

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • krampuswillgetyou
    New Member
    • Mar 2010
    • 1

    running an exe file from a python script

    Hello,

    I found this website while I was trying to search a solution/ recipe for a problem I am trying to tackle... I am very new to python :(

    How can I run an executable file from a python script?

    for example:

    All the files (python script - filename.py-, executable file -filename.exe-, and the file that needs to be processed by the executable file -filename.txt-) are in the same directory - new_folder-.

    What do I need to write or include to my script (filename.py) so that it would start filemane.exe would process filename.txt and produce an output file / results?

    any help is greatly appreciated!

    you can directly email me at

    ******email address deleted******
    Last edited by bvdet; Mar 25 '10, 06:59 PM. Reason: Removed email address
  • bvdet
    Recognized Expert Specialist
    • Oct 2006
    • 2851

    #2
    Please don't post your email address. This is for your protection.

    Comment

    • bvdet
      Recognized Expert Specialist
      • Oct 2006
      • 2851

      #3
      Module os has some useful functions. Here's one of them as an example:
      Code:
      >>> os.spawnv(os.P_WAIT, "X:\\Python26\\python", ("python", ''))
      0
      >>>
      >>> os.spawnv(os.P_ WAIT, "X:\\Python26\\ python", ("python", ''))
      0
      >>>

      Edit: The process returned "0", but it will not display between the code tags.

      Comment

      Working...