I had the same issue running Python in Visual Studio Community. In Debug > Properties, the application startup file was one of my app config files, not the application startup file, somewhow it had been changed. Following the change my application worked as expected.