0

I have a game (.exe using python) that prints some console logs and I want to see these WHILE the game is running.

I have already seen solutions like: cmd /k start.exe but that only shows the console AFTER the game has stopped. I want it to be shown WHILE the game is running. Is this possible? Or is there some sort of python command I can run to open a console terminal during game?

edit I'm using the blender game engine to create a .exe which is executing python script. Solutions I have come across temporarily close the terminal window until the .exe game is closed. I would like it to stay open while the game plays.

  • cmd.exe is a shell that inherits or allocates a console like any other console application. If the game is also a console application, then it should inherit its console from CMD, after which CMD does nothing but wait for the game to exit. It sounds like the game may be hiding the console window while running. No program should ever hide an inherited console. It's only ok for a console that's manually allocated via `AllocConsole`. – Eryk Sun Dec 27 '17 at 22:01

2 Answers2

0

click start

in the run box type "cmd.exe"

in the terminal type "cd /path/to/my/prog"

then type "my_prog.exe"

output should be printing to the console ....

it should be noted you have not really supplied enough information to actually answer this question, but i think this should work as long as the exe is printing to stdout

Joran Beasley
  • 110,522
  • 12
  • 160
  • 179
  • Thanks for the quick response! I've been doing this with "cmd /k start.exe" but what happens is the game starts and the console closes. It then plays and AFTER it closes, the console returns showing the "print" messages, but this is less than ideal since I have to quit the game every time I want to see console logs. I'm using the blender game engine which uses python, so I dont have access to stdout, just print – Travis E Miller Dec 27 '17 at 18:47
  • To clarify, I tried your method as typed, but the cmd terminal closed once the .exe started, reopened after it finished. – Travis E Miller Dec 27 '17 at 18:56
  • prrint should just be printing to stdout... I havent messed with blender, but this is not python related... its something blender is doing specifically – Joran Beasley Dec 27 '17 at 18:58
  • 1
    not really an answer to your question but maybe a workaround: if you redirect stdout to a text file (like [here](https://stackoverflow.com/questions/4675728/redirect-stdout-to-a-file-in-python)), you could have the text file open in an editor while your game is running ... – Amos Egel Dec 27 '17 at 18:59
0

https://docs.blender.org/manual/en/dev/advanced/command_line/arguments.html

This will keep the console open while running -con, --start-console Start with the console window open (ignored if -b is set), (Windows only).

This will keep it open after running cmd /k

So I created a .bat file with the following cmd /k simple_start.exe -con