1
$\begingroup$

I have a python script. It works well when I run the code in python console but if I open the script file in text editor and click "Run Script", blender crashed.

Does anyone know what might causes the difference?

Here is the script:

import bpy 
from bpy import data as D 
from bpy import context as C 
from mathutils import * 
from math import * 
import blensor 
bpy.context.scene.objects.active=bpy.data.objects['Camera']
blensor.tof.scan_advanced( max_distance = 20.0) 
$\endgroup$
8
  • 3
    $\begingroup$ Yan, pasting the script in your question might give some clues. $\endgroup$ Commented Sep 9, 2015 at 16:35
  • 1
    $\begingroup$ It could be a number of things, the easiest way to find out is to toggle system console found in the window menu if you are on Windows. This will open a second window which will be a text console. Any errors when running the script will be reported here so you can find the cause. If you can't solve the issue you will have to post the actual script here before anyone can help. $\endgroup$ Commented Sep 9, 2015 at 16:54
  • $\begingroup$ I am using the python script to execute blensor add on. Here is the script: import bpy from bpy import data as D from bpy import context as C from mathutils import * from math import * import blensor bpy.context.scene.objects.active=bpy.data.objects['Camera'] blensor.tof.scan_advanced( max_distance = 20.0) $\endgroup$ Commented Sep 9, 2015 at 17:50
  • $\begingroup$ Thank you! I have toggled the system console. When blender crashed, system console also disappeared. When I run the script in commond line by " blender myscene.blend --background --python myscript.py". The crash message it gives indicates some parameter is not set. For this parameter, it has a default value. And everything works well in python console. So it confuses me. $\endgroup$ Commented Sep 9, 2015 at 17:53
  • 2
    $\begingroup$ @leon-stafford not sure what that script is - those import lines contain some horrible frightening shivering things! Beyond that, since we do not know what does the blensor code, it's very hard to answer… $\endgroup$ Commented Sep 9, 2015 at 20:11

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.