1.11M Members

how to use c program in Python

 
0
 

hi to all
i want to use c program in python
or in other way i want to run c program from python

 
1
 

Run an external program from within Python code with
subprocess.call(["program-name", "arg1", "arg2"])
rather than os.system("program-name arg1 arg2")
since os.system() does not allow the Python program
to run in the background, whereas subprocess does.

Example ...

# play a midi file with a small external midiplayer:
# from http://www.kanatachoralsociety.ca/memberscorner/AKoffPlr.exe
# mplayer2.exe works too, but not wmplayer.exe
import subprocess
subprocess.call(["C:/Midi_stuff/AKoffPlr.exe", "DaarG.mid"])
Question Answered as of 9 Months Ago by vegaseat
You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article