6
$\begingroup$

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?

$\endgroup$
7
$\begingroup$
  • 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

$\endgroup$
  • $\begingroup$ thanks for the suggestion, it worked cd "c:\Program Files\Blender Foundation\Blender"<br> blender<br> $\endgroup$ – ShungChing Jan 5 '15 at 18:23
  • $\begingroup$ 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. $\endgroup$ – David Jan 6 '15 at 17:16
4
$\begingroup$

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

$\endgroup$
  • $\begingroup$ 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<br> it was a minor typo that may confuse others who may want to try your suggestion. $\endgroup$ – ShungChing Jan 5 '15 at 18:21
  • $\begingroup$ @ShungChing the quote in my post is exactly how I have it on my system, but it appears the quotes can be dropped entirely. $\endgroup$ – zeffii Jan 6 '15 at 11:57
  • 1
    $\begingroup$ If there is a space in the path, it must be wrapped in quotes. $\endgroup$ – Greg Zaal Jan 7 '15 at 5:22
  • $\begingroup$ 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 program<space>files $\endgroup$ – zeffii Jan 7 '15 at 12:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.