Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
Running exec file from python issue
I trying to run exec file from python, and to get the output immediately to the screen and to variable, and also to get the return code.
When I use the commnd "os.system(cmd)" ,I get the output to the screen, but I cant get it to variable ( I get only the return code );
When I use the commnd "stat_output = commands.getstatusoutput(cmd)", I get the output and the return code to var.
but if I want to get the output to the screen I need to wait until the command is ended.
How can I get the output immediately to the screen, and also to var?
Thanks in advance
0 · ·