'Mesh' object has no attribute 'uv' I'm trying to update an old script and I'm near to achieve my goal but I'm locking at getting uv coordinates because the old script used the texture assigned using the UV image editor and the new one need to use the texture assigned with material.

Then the thing I don't find is how to get the uv as easy as the vertex coordinates.
This is the code I have to get faces:

face_count = len(self.ob.data.polygons)
print("face count: "+str(face_count))

for f_index in range(face_count):
    uv_polygon = self.ob.data.polygons[f_index]

    vertices = []
    # export the triangle
    for i in range(3):
        vertices.append([self.ob.data.vertices[uv_polygon.vertices[i]],
                        self.ob.data.uv[uv_polygon.vertices[i]]])
    try:
        Face(vertices, uv_polygon.material_index)
    except:
        Face(vertices, -1)


The error appears here: self.ob.data.uv[ uv_polygon.vertices[i] ]
because uv is not an attribute of mesh.

Thanks
UV coordinates are stored in ob.data.uv_layers.active.data[loop_index].uv since the mesh system update (NGons are supported from 2.63 on). Note that a loop index is required, not a vertex index.

UV textures are stored in ob.data.uv_textures.active.data[face_index].image.

http://www.blender.org/api/blender_python_api_2_73_release/info_gotcha.html#ngons-and-tessellation-faces

You might wanna use the tessface mesh (triangles and quads) for your export. Don't forget to triangulate quads, your original code doesn't seem to handle them at all. Here's an example:

https://code.google.com/p/blender-cod/source/browse/blender_26/export_xmodel.py#518