Setting objects into edit mode often seems to fail in python script
As mentioned by dimus, your problem is solved by adding keyword to the mesh.remove_doubles operator's first argument, meant as threshold property value. With that little bug fixed, your script works properly.

What causes the error is that, keyword arguments are used to set operator properties, and positional arguments to set how the operator is called (further explained in the API docs). By not using a keyword for the first argument, you're turning it into a positional argument, thus interpreted as operator execution context which is an error.

EDIT: Another possible error is iterating over bpy.data.objects, which comprises of all objects in every scene in a file. The script is bound to fail if there's more than one scene in a file containing a MESH object, because it'll try to make object from a different scene the active object of current scene which is contextually incorrect. You should iterate over bpy.context.scene.objects instead.

Here's the amended code, can't see any other bug:

import bpy

scene = bpy.context.scene
scene.layers = [True] * 20 # Show all layers

for obj in scene.objects:
    if obj.type == 'MESH':
        scene.objects.active = obj

        bpy.ops.object.mode_set(mode='EDIT')
        bpy.ops.mesh.remove_doubles(threshold=0.0001)
        bpy.ops.object.mode_set(mode='OBJECT')