How do I select a all objects in a particular group?

I would like to select all objects that I have placed in a group named ‘gems’. I have found this operator in the doc

bpy.ops.object.select_grouped()
http://www.blender.org/documentation/blender_python_api_2_61_4/bpy.ops.object.html#bpy.ops.object.select_grouped

but I have no idea on how to target the group ‘gems’. Any ideas?

You need to select at least one object in the ‘gems’ group, then you can do:

bpy.ops.object.select_grouped(extend=True, type=‘GROUP’)

to select all the objects in the group, otherwise there is no object context for the operator.

You could also iterate over the group and select them one by one:

import bpy

for ob in bpy.data.groups['gems'].objects:
    ob.select = True