Python scripting failed
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.