11

I am testing a script in Blender game engine. I can view the helpful message on the external system console when the script throws exception. Sometimes the bugs of the script cause the Blender to crash and close the console immediately.

Is there any way to view the message after the Blender crashes? How to write the message to a text file for later viewing? Any suggestion?

ShungChing
  • 343
  • 3
  • 9

3 Answers3

13
  • On windows just run blender from Command Prompt:

    Win Key+R

    In field type cmd and hit OK. Inside the console navigate to your blender.exe with command

    cd c:\Program Files\Blender Foundation\Blender\ (or whatever your path is)
    instead you can also navigate to the folder in the Explorer and SHIFT+Rightclick on the Folder and select Open Comand Promt here

    and then type blender.exe

    You can also use command line arguments.

    Now even if Blender crashes, you will still see the program output in the console.

  • On OSX use Terminal app and run it like

    cd /Applications/Blender
    ./blender.app/Contents/MacOS/blender
    
  • On Linux open terminal and run

    cd <blender installation directory>
    ./blender
    

You can start blender (or blender.exe) with the option --factory-startup attached to check if a addon or a setting caused the crash

Jaroslav Jerryno Novotny
  • 51,077
  • 7
  • 129
  • 218
  • thanks for the suggestion, it worked

    cd "c:\Program Files\Blender Foundation\Blender"
    blender

    – ShungChing Jan 05 '15 at 18:23
  • On vista and windows 7 you do not have to open the run window. You can type cmd in to the start menu and press enter. – David Jan 06 '15 at 17:16
7

Start blender from a console / cmd prompt in the first place and if it crashes, it will just return to the console and not close the console.

For windows i set up a bat file to load cmd.exe, with any of these variants:

start C:\Windows\System32\cmd.exe /k C:\blender_trunk\blender.exe --debug-all

start C:\Windows\System32\cmd.exe /k C:\blender_trunk\blender.exe --debug

start C:\Windows\System32\cmd.exe /k C:\blender_trunk\blender.exe

It will load the cmd prompt, then blender, and depending on how much info you want you add the debug flag. Make a shortcut to the bat file, and all you have to do is click it to start Blender + console

zeffii
  • 39,634
  • 9
  • 103
  • 186
  • thanks for the suggestion, i tried and found that the quote should be as follows:

    start C:\Windows\System32\cmd.exe /k "c:\Program Files\Blender Foundation\Blender\blender.exe" --debug-all

    it was a minor typo that may confuse others who may want to try your suggestion.

    – ShungChing Jan 05 '15 at 18:21
  • @ShungChing the quote in my post is exactly how I have it on my system, but it appears the quotes can be dropped entirely. – zeffii Jan 06 '15 at 11:57
  • 1
    If there is a space in the path, it must be wrapped in quotes. – Greg Zaal Jan 07 '15 at 05:22
  • yes, that's what I thought! my original path doesn't have spaces so the quotes aren't even needed, whereas @ShungChing's path is programfiles – zeffii Jan 07 '15 at 12:11
1

Go to the Menu Bar > Windows and click on Toggle System Console

Duarte Farrajota Ramos
  • 59,425
  • 39
  • 130
  • 187
bdthombre
  • 21
  • 1
  • 2
    Please note the Toggle System Console menu item exists only for Microsoft Windows OS builds of blender. – batFINGER Mar 25 '20 at 01:12