Reputation: 1266
I would like to write a PowerShell script which will execute a Python script on a remote PC. The script prompts the user to type 'Y' or 'N' to continue execution of it.
To log in remotely, I type
enter-pssession -ComputerName <Computer Name> -Credential <DOMAIN>\<username>
Then I type:
python ".\update_software.py"
The script prints out the text before the prompt, but instead of the prompt, I receive the following error message:
python.exe : Traceback (most recent call last):
+ CategoryInfo : NotSpecified: (Traceback (most recent call last)::String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
File ".\update_software.py", line 19, in <module>
_runner.execute()
File "C:\aimplatform2\aim\software_updater\run_update.py", line 76, in execute
res = raw_input("> ")
EOFError: EOF when reading a line
If it helps, I am running Windows XP and remoting into a Windows XP machine.
Upvotes: 3
Views: 3185
Reputation: 9680
According to python documentation,
raw_input([prompt]) -> string
Read a string from standard input. The trailing newline is stripped.
If the user hits EOF (Unix: Ctl-D, Windows: Ctl-Z+Return), raise EOFError.
On Unix, GNU readline is used if enabled. The prompt string, if given,
is printed without a trailing newline before reading.
So you must have pressed (or Powershell might have inserted that) CTRL+Z Enter in your raw_input function.
Upvotes: 2