4

My Python 3 (3.6) opens new black console window for each Python command I run (pip is just the same).

Example: When I create a hello_world.py with a while True: print("hello world") Loop in it and start it from PowerShell via python test.py it will open a new window, print "hello world" in the new window and leave the console I used to run the script empty... (same happens with Cygwin) using CMD it won't even open the Python window and just closes gives me back a new CMD prompt-line.

Even worse when using PyCharm each time a background-task runs (e.g. syntax-check) a black console window opens for ~1 sec. and thus blocks me from writing code.

Example images to show what is happening:

Code used for test.py:

while True:
    print("Hello World")

Example 1

Example 2

So far I tried:

  • creating and modifying manifest files for python.exe/pythonw.exe
  • reinstalling Python3
  • installing a different Python3 Version
  • changing the default codepage for CMD/PowerShell
  • setting PYTHONENCODING and PYTHONIOENCODING to UTF-8
  • starting PowerShell/Python as admin

//edit:

the Question is: How can I get back the default Python behavior, as seen on every other (Windows) Computer.

M. Schwarz
  • 41
  • 5
  • What's the output for `where python`? And `where py`? – Eryk Sun May 19 '18 at 15:53
  • where python: D:\Python36\python.exe, where py: C:\Windows\py.exe – M. Schwarz May 19 '18 at 18:53
  • Does this also happen from `cmd.exe`? Ask on superuser. – Bill_Stewart May 19 '18 at 21:15
  • This issue bugs me but feels like a Python bug in relation to using the PoweShell which is meant to replace the old DOS command-prompt. Running "py ./test.py" is a semi-fix but ideally whatever mechanism allows running "./test.py" needs to be aware it is being run from a shell instance instead of command-prompt. Is there a bug board for the python project? – Crog Mar 28 '19 at 15:53

1 Answers1

0

I found the solution is just run cmd or powershell as Administrator any other type of user would cause this problem.

peter tom
  • 11
  • 1