# Warning when applying modifier via Python?

I am creating an icosphere and subdivide it.

When I do it in the GUI console, no warnings.

However, when I put these code into a script and invoke it by blender --background --python ..., I get the following warnings.

warning DM_ensure_tessface: could not create tessfaces from 240 polygons, dm->type=2
warning DM_ensure_tessface: could not create tessfaces from 960 polygons, dm->type=2


What does this warning mean?

No errors here. Make sure that the context is set to Object Mode and save the file:

import bpy

# set context
bpy.ops.object.mode_set(mode='OBJECT')

# get active object
target = bpy.data.objects['Icosphere']
bpy.context.scene.objects.active = target

# apply modifier
bpy.ops.object.modifier_apply(modifier="Subsurf") # apply_as='DATA'

# save the file
bpy.ops.wm.save_as_mainfile(filepath=bpy.data.filepath)


Command line:

blender -b <path-to-blend-file> --python <path-to-python-script>

• I tried setting context to Object Mode, but the error seems to persist? – Sibbs Gambling Jun 30 '17 at 18:34