catch NameError because of Windows
add more namespaced modules for windows
Remove unused imports
add missing imports
use two spaces before inline comment

Keep pylint happy
properly namespace win_file.remove

fixes #10233
namespace win_file.append

fixes #10233
Ignore unused import.
Merge pull request #10419 from s0undt3ch/0.17

0.17 cherry-picks