0
votes

I have a python script foo which uses getpass to prompt for a password. This python script works at the windows powershell command line:

PS D:\Users\me\projects> foo
Password:

I am calling this python script within a powershell script bar.ps1 and everything still works fine at the command line:

PS D:\Users\me\projects> .\bar.ps1 -bar_argument 42
bar_argument is: 42
calling foo
Password:

The above works when I run the script in the Intellij Terminal but when I setup a powershell run configuration using the Intellij powershell plugin the "Password:" prompt never appears and the powershell script just hangs:

C:/Windows/System32/WindowsPowerShell/v1.0/powershell.exe -File D:\Users\me\projects\bar.ps1 -bar_argument 42

bar_argument is: 42

calling foo

How can I run a powershell script using the Intellij run configuration and have the script work interactively (similar to the command line behavior)?

Thank you in advance for your consideration and response.

2

2 Answers

1
votes

Your python script needs to run non-interactively, since it's called as such by the PowerShell script. Move the interactive part to the PowerShell script an pass the value as an argument to the python script.

1
votes

Although it is not the powershell terminal the following worked for me with

  • win10
  • IDEA 2019.1
  • phyton 3.7.4 (installed: py launcher and associate files with phyton)

In IDEA windows Terminal execute the following command

  • path

and make sure the path to phyton.exe is set

execute the script with py. It should work:

enter image description here