0

I am new to python and I would like to run a .exe file using python (Win).

One major output of this external .exe file is to save a log file, and the original code was written in C. I run this .exe file by calling Popen as suggested by some answers, but it did not save any file.

A simplified version of this question would be: 1. I start a C project that writes "Hellow World" to a text file called "1.txt". 2. This C file is then built and compiled into an executable file called a.exe. 3. I run this a.exe file in python by called subprocess.Popen("a.exe"). 4. Nothing saved.

Any idea?

Thanks.

NathanOliver
  • 171,901
  • 28
  • 288
  • 402
Jack
  • 1
  • Does this answer your question? [Running an outside program (executable) in Python?](https://stackoverflow.com/questions/1811691/running-an-outside-program-executable-in-python) – ksohan Jun 12 '20 at 19:43
  • did you validate that running .exe file causes saving file `1.txt`? – rok Jun 12 '20 at 19:54
  • Yes, I have validated the .exe file, it works properly. – Jack Jun 13 '20 at 20:45
  • @KaziSohan It's quite different questions, I can execute my .exe and capture real-time output, for example, stdout. However, the writing part is ignored. – Jack Jun 13 '20 at 20:49

0 Answers0