Blender ( ubuntu ) crashes when I run a simple script

Hi, I am very new to Blender (and Ubuntu )

I just try to run a simple script , something like :

import bpy
bpy.ops.object.modifier_add(type=“SUBSURF”)

I run the script, it works fine, and I can see the result in the viewport. And then, everytime, Blender crashes completely.

Anyboy has a clue about what’s happening to me ?

What Blender version? Blender installed from Ubuntu repositories or downloaded from the Blender website? Does the problem happens with any scene?

You open Blender from Ubuntu terminal, apply the script and when the problem occurs, you see if you find any useful error message at the end of the terminal.

thanks YAFU, I will try that

Blender does crash when it runs out of memory. You are adding a modifier that uses memory. What else is in your scene? How much memory do you have? Are you running the latest Blender?