Python scripting failed I am having a "python script fail" on my project that I am working on and I do not know why. my script is programmed to turn on one lamp at a time and render an image with a different lamp turned on for each render. 

import bpy, bgl, blf,sys
sceneKey = bpy.data.scenes.keys()[0]
filepath = "G:\rtitrial2"
# Loop all objects and try to find the Lamps
print ('Looping Lamps')
l=0
# first run through all of the lamps turning them off
for obj in bpy.data.objects:
    if ( obj.type =='LAMP'):
        obj.hide_render = True
        l = l + 1
print('You have hidden ' + str(l) + "lamps")

# now we can go through and
# individually turn them on
# and render out a picture
for obj in bpy.data.objects:
    if ( obj.type =='LAMP'):
        print (obj.name)
        obj.hide_render = False
        bpy.data.scenes[sceneKey].render.image_settings.file_format = 'JPEG'
        bpy.data.scenes[sceneKey].render.filepath = filepath + '//lamp_' + 
str(obj.name)
        # Render Scene and store the scene
        bpy.ops.render.render( write_still=True )
        obj.hide_render = True
Instead of using bpy.data.scenes[sceneKey], just use bpy.context.scene to access the current scene. You also don't need the parentheses around conditions (it's Python, not C or Java). More important is the string assigned to filepath, though. \r means "carriage return". Just use forward slashes, Windows can handle those too.

Alternatively you can use \\r.