You're right, it's the extension type. startfile
operates like double-clicking a file in Windows explorer, so if you navigate to a Python file (.py) and double-click it, it launches the file and the console. If you want just the file, change it to:
os.startfile(r"C:\Python27\Lib\idlelib\idle.pyw")