OSError occurs in Linux

It is not required in this case (although I think there are plans to deprecate the existing handling of such backslashes), since \s is not a recognized escape sequence and thus the \ is parsed literally:

>>> 'C:\subpro.exe'
'C:\\subpro.exe'

However, it’s certainly good style - but better yet for file paths is to use forward slash as a path separator, even on Windows.

The quotes look like that because OP did not format the code properly for the forum. In plain text, the forum software converts ' and " to “smart” quotes automatically (which may look different yet again when put back inside code formatting, depending on the font).

1 Like