Blender 4.1 Text Editor vs jumping to line with error

Hey there!
I’m running a code in Text Editor, and when it gives back error, it not jumps to the line where execution halted due the error.
I’m switching from Blender 3.2, so maybe i forgot to turn on some feature or something :slight_smile:

Better provide some video or images, pretty hard to say otherwise.

You should at least see a popup that tells you the row where your script stopped.

Here I added some nonsense after a print, and Text Editor will show the line with syntax error, when I pressed the Run button.

error

Yes, i get an error message with the error line(s), but in Blender 3.2 program is jumping to the first error line that stops the script.

Well isn’t that exactly what it should do? Code is executed line by line in order, and it gets stopped on first error?

Anyway - see the error box you get - it clearly says what happens:

So you are trying to concatenate None type (when object doesn’t exist) with a string object.

You should first check if you actually got an object.

1 Like

“Well isn’t that exactly what it should do? Code is executed line by line in order, and it gets stopped on first error?”

Please check the title of the topic, plus the comment:
“Hey there!
I’m running a code in Text Editor, and when it gives back error, it not jumps to the line where execution halted due the error.
I’m switching from Blender 3.2, so maybe i forgot to turn on some feature or something”
plus the video i provided :slight_smile:
(hint, the problem is represented in Blender 4.1, not in Blender 3.2 ;-))

The behavior still works in Blender 3.6 but yes, I’ve confirmed that in 4.1 it does not move the cursor to the line the error occurred on. You should report this as a bug, perhaps after looking through the release notes to see if it is intentional for some reason.

edit: Still works in 4.0.2 as well.

1 Like

For me, Blender 4.1 Text Editor seems to work properly for syntax errors.

If I get a syntax error, cursor will get moved to that line.

However, if I get a runtime error - cursor won’t move to that line.

In your case, you get a runtime error.

This is same for both 3.6, 4.0.2 and 4.1 Blender. I don’t have any other versions installed to test.

Edit - and you will see this error in your Python Console, so then you can go to this line.

1 Like

Well your code won’t run anyway, but did you actually test this exactly same code in Blender 3.2 and is it so that there the cursor moves to that line? Can you verify this?

See my previous answer about runtime error. Since there seems to be a difference between syntax and runtime error handling.

And btw, I did check your video, but missed the “3.2” part of your text line.

I used the same code for all my tests and runtime errors like None + a string jump in 3.6 and don’t in 4.1.

edit: I know there have been a bunch of addons for Text Editor over the years to enhance it. Could it be something that was enabled that is not now?

Can you share this part of the code, I could test this with 3.6.8 - I don’t care about full code.

Dead simple:

foo = None

print(foo+"boo")

print("yo")

Will put the cursor after line 3 in 3.6, will not in 4.1.

1 Like

Well I don’t think it is that simple for every case. If the line is inside a function, that doesn’t work like that - not even in blender 3.6.8. I’m not saying there isn’t a difference - seems like your example does that in Blender 4.1, but you rarely have lines of code in file like that.

It works fine in 3.6 inside methods and doesn’t in 4.1. Python has strong line reporting in tracebacks. This one jumps to line 2 in 3.6 and doesn’t in 4.1.

def foo(bar):
    print(bar+"blah")

foo('bar')

foo(None)

I don’t know why you’re fighting so much against this, it’s clearly changed in 4.1.

1 Like

Can you try this - for me it doesn’t seem to be doing what you say - in 3.6.8, cursor simply moves to the line where operator gets called. I double checked I had this open in Blender 3.6.8

import bpy

def do_something(context):
    x = None
    y = print(x + "foo")

class SimpleOperator(bpy.types.Operator):
    """Tooltip"""
    bl_idname = "object.simple_operator"
    bl_label = "Simple Object Operator"

    @classmethod
    def poll(cls, context):
        return context.active_object is not None

    def execute(self, context):
        mode = do_something(context)
        return {'FINISHED'}

def register():
    bpy.utils.register_class(SimpleOperator)

def unregister():
    bpy.utils.unregister_class(SimpleOperator)

if __name__ == "__main__":
    register()
    bpy.ops.object.simple_operator()

Wohaa, lot of feedbacks :slight_smile:

ezez, when You check the video, from 0:00 to 0:09 it is blender 3.2, then it is blender 4.1
I can’t demonstrate the issue better than that :slight_smile:
As i can see obsurveyor also experiencing the same issue.
At least i know it’s not just my blender version went crazy.

Thank You for the answers!