import bpy
from bpy import *
import Blender.Draw as Draw
#Retrieving the material of the selected object
mat = []
sce = data.scenes.active
ob = sce.objects.active
nmesh = ob.getData()
mat = nmesh.getMaterials()[0]
mat.setRGBCol(1.0,0.0,1.0)
This code works if the nmesh already has a material added to it,
but you must add the material manually. I have looked around, and
I have found the object.setMaterials() method. I can not seem
to find a working example of it being used, and I am also
not sure what to put into the method’s parameters. Thanks