So I have created a executable from cmake file name "COSMO" which is running fine if I run it from Linux command terminal
$ cat COSMO
I am getting desired output But if I want to open same file using python I use
$ python3 file.py
where python3 file contains code
import subprocess
def executable_shell():
x=subprocess.run('cd build && cat COSMO', shell=True, capture_output=True)
print(x)
executable_shell()
to make sure cd command is not interfering I make a python file inside build directory where my cmake file is created.
now in both cases I am getting random gibbrish like when i open the executable from notepad. whereas if i run this file directly the format is fine.
if i use .stdout.decode() it is saying codec can't decode byte 0xf8 in position 96: invalid start byte
i have used my subprocess command and it is working fine for commands like ls, cd etc. so how will run it in python