5
$\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$
4
$\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.

$\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
  • 2
    $\begingroup$ There is no Window -> Toggle System Console entity in Blender $\endgroup$ – Dims Jul 21 at 19:58

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.