# Apply armature transform through Python

I'm trying to autom the applying of several objects armature transformation. Nevertheless, I cannot achieve it with the code below. On tests, it seems that the problem lies in the last but one line.

import bpy

context = bpy.context
scene = context.scene

objs = bpy.data.objects

for obj in objs:
if obj != None:
obj.select = True
bpy.context.scene.objects.active = obj
bpy.ops.object.transform_apply(apply_as='DATA', modifier="Armature") #this line is throwing error
obj.select = False


Thanks for helping!