Actually I take it back.  Neither the top nor the bottom example will run successfully in Visual Studio Code (under Linux).  Both work in straight python in linux, and the lower works on Windows in VSCode.
So is there something wrong with the second example?  Or is there something wrong with VSCode in linux?