14
$\begingroup$

I don´t understand why I get this error message:

Python script fail, look in the console for now

I only put this piece of code in the scripting window:

import bge
bge.render.drawLine([0,0,0],[10,10,10],[255,40,0])

Is supposed I get error information from the console? Because I dind´t get it.

enter image description here

$\endgroup$
12
$\begingroup$

You will need to open the system console, which is found by going to the Window menu at the top and choosing Toggle System Console. Do note that closing the console via the X button at the top right will close Blender as well, so if you want to close the console use the Toggle System Console menu option again.

EDIT: I just tried the code you have and it works fine. I think your issue is how you are trying to execute the code. To execute this code in the BGE you will need to have an object that has a sensor (such as an always sensor with true level triggering enabled) connected to a python controller with your script selected.

Then play your game and you will see your line. Simply running the script via the text editor will cause it to fail.

| improve this answer | |
$\endgroup$
  • $\begingroup$ I click on "Toggle System Console", as you advise me, and appears a window with the title of "Blender", but it don´t give me any information about the error. $\endgroup$ – Mr. Baldan Jan 6 '18 at 19:01
  • $\begingroup$ Sorry, It´s true...I see error information on the window that appears when I click on "Toggle System Console". In this case the information is: ImportError: No module named "bge". $\endgroup$ – Mr. Baldan Jan 6 '18 at 19:07
  • 9
    $\begingroup$ There is no Window -> Toggle System Console entity in Blender $\endgroup$ – Dims Jul 21 '19 at 19:58
1
$\begingroup$

For the people saying that "There is no Window -> Toggle System Console entity in Blender". Then I presume you are on macOS or Linux and will have to open Blender from your systems terminal.

On macOS you would

  1. Find Blender.app
  2. Right click and show package content
  3. Navigate to "Contents/MacOS/"
  4. Drag the "Blender" file into a terminal window
  5. Press enter to start, your output will now be seen in that window.

On Linux:

cd /usr/share/applications

gtk-launch blender.desktop

| improve this answer | |
$\endgroup$
  • $\begingroup$ It would be a great interface enhancement to have those messages easily visible for people launching the application "as usual" (from the standard shortcut) on those platforms... $\endgroup$ – villares Oct 11 at 20:40

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.