The 10.1 Spatial Analyst Kernel Density tool in Python uses a % sign in the name of the output raster if a 10.0 Query layer is used, which causes the code to fail.
Set the scratch workspace to a folder.arcpy.env.scratchWorkspace = r"<a href="file:C:/temp" target="_blank">C:\temp</a>"kernelOut = <a href="http://arcpy.sa" target="_blank">arcpy.sa</a>.KernelDensity("qltest", "NONE")kernelOut.save(r"<a href="file:C:/My/Real/location.gdb/KernelOutput" target="_blank">C:\My\Real\location.gdb\KernelOutput</a>")