[SOLVED] run(powershell script.ps1) timeout
Published: July 27, 2017 - 10:05 AM
Good morning,
I'm trying my luck here.
I'm creating a post-installation package that will configure the workstations by running a PowerShell script. So, to answer a potential question of "why am I not doing this post-installation in pure Python?" right away: because I already have the PowerShell script, and it's very long. Besides, there's no reason why we can't run PowerShell!
So whatever the script, it times out; it seems that psutils.Popen is not detecting the script's exit code.
For this example, I tested it with a very simple script:
Then in Python:
I observe that the code is executed correctly, but the instruction never finishes, or rather at timeout=600.
Any ideas? What other solutions are there? I also tried it with the same error:
And it's even more bizarre.
Thank you in advance!
I'm trying my luck here.
I'm creating a post-installation package that will configure the workstations by running a PowerShell script. So, to answer a potential question of "why am I not doing this post-installation in pure Python?" right away: because I already have the PowerShell script, and it's very long. Besides, there's no reason why we can't run PowerShell!
So whatever the script, it times out; it seems that psutils.Popen is not detecting the script's exit code.
For this example, I tested it with a very simple script:
Code: Select all
echo "coucou" > c:\tmp\fichier.txt
exitCode: Select all
run('powershell -NoProfile -NonInteractive -File c:/tmp/test.ps1')Any ideas? What other solutions are there? I also tried it with the same error:
Code: Select all
with open('test.ps1','r') as f:
data=f.read()
run_powershell(data)Thank you in advance!