unspecified-encoding (PLW1514)#
Derived from the Pylint linter.
This rule is unstable and in preview. The --preview
flag is required for use.
What it does#
Checks for uses of open
and related calls without an explicit encoding
argument.
Why is this bad?#
Using open
in text mode without an explicit encoding can lead to
non-portable code, with differing behavior across platforms.
Instead, consider using the encoding
parameter to enforce a specific
encoding.
Example#
Use instead: