I have been having a strange issue. For work I am wanting to open a powershell file through python due to various reasons. I have been stuck on how to do this because I have tried everything. Well I have coworker (that works in a much different timezone) email me saying to do this and how it worked for him:
import subprocess as sub
def runMain():
ab = sub.Popen(["powershell.exe", "C:\\TestAutomation\\ePuse\\ePuse.ps1"], stdout=sub.PIPE)
ab.communicate()
if __name__ == '__main__':
runMain()
He even showed me a screenshot verifying it worked for him. However, I have tried his code and it's not working for me at all. It just keeps outputting "process finished with exit code 0"
Does anyone have any idea on what is going on here ? I really can't understand what I'm doing wrong. I don't know what version of python he is using, but I'm using 2.7 (I was advised too). Could it be another version of python he is using ? Why is my code not outputting anything ? Thanks for the help.