windows - Python Interpreter crashing in Powershell ISE -


i have python 3 installed on system , path executable has been added path. when inter python in windows powershell (win8.1) runs fine, i'd use powershell ise advanced features has. running python in powershell ise crashes following log:

python : python 3.4.3 (v3.4.3:9b73f1c3e601, feb 24 2015, 22:43:06) [msc v.1600 32 bit (intel)] on win32 in zeile:1 zeichen:1 + python + ~~~~~~     + categoryinfo          : notspecified: (python 3.4.3 (v...ntel)] on win32:string) [], remoteexception     + fullyqualifiederrorid : nativecommanderror  type "help", "copyright", "credits" or "license" more information. >>>  

(sorry partly in german)

i can't enter , have ctrl+c powershell.

what might issue here?

powershell ise isn't meant running typical interactive console programs such python.exe. hides console window , redirects stdout pipe. see in practice run following in ise:

python.exe -i -c "import ctypes; ctypes.windll.user32.showwindow(ctypes.windll.kernel32.getconsolewindow(), 5)" 

enter text in console window, , you'll see input echoed in console, output gets piped ise.


here's brief overview of windows console applications. powershell.exe, cmd.exe, , python.exe console applications function clients of console server (or host) process, conhost.exe. host process creates window , runs typical gui event loop. when run python.exe gui application, such explorer.exe, windows executes new instance of conhost.exe, creates new console window. when run python.exe console application, such powershell.exe, default behavior inherit console of parent.

the console api communicates attached console host. many of functions, such writeconsole, require handle console input or screen buffer. if you're attached console, special file conin$ represents input buffer, conout$ current screen buffer, , con can refer either depending on whether it's opened reading or writing. (you may have seen command in cmd.exe such copy con somefile.txt.)

a windows process has 3 fields used standard i/o handles. console process standardinput defaults handle conin$, , standardoutput , standarderror default handles conout$. c runtime library opens these standard file streams stdin, stdout, , stderr using file descriptors 0, 1, , 2. when starting process of standard handles can instead set open file or pipe.

while process can attach 1 console @ time, multiple processes can attached single console. however, 1 process active. in case of powershell.exe, example, after running python.exe main thread waiting in background python.exe exit. (note execution model fails badly if in python.exe start interactive console process , exit, since both shell , child process compete access console.)


Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -