# Blender uv stitch operator problem

I am trying to execute the stitch operator but it works only in gui when trying to execute it from a command line it doesn't run the operator here is a code snippet that i have now :

for ob in bpy.data.objects:
if ob.type == 'MESH':
j = 0
ob.select = True
bpy.context.scene.objects.active = ob
#############################
bpy.ops.object.mode_set(mode="EDIT")
bpy.ops.mesh.select_all(action='SELECT')
bpy.ops.uv.select_all(action="SELECT")
bpy.ops.uv.stitch(use_limit=False, snap_islands=True, limit=0.01, static_island=0, midpoint_snap=False, mode='VERTEX')
bpy.ops.object.mode_set(mode="OBJECT")


Executing this code inside the command line using the "--background" doesn't give any errors but it don't run the operator