Getting unspecified-encoding
when using Path().open('rb')
#5018
Labels
Milestone
unspecified-encoding
when using Path().open('rb')
#5018
Bug description
I am running into the error
unspecified-encoding
when usingPath().open("rb")
Example python code:
file.py
hello.txt
Configuration
No response
Command used
Pylint output
************* Module file file.py:7:5: W1514: Using open without explicitly specifying an encoding (unspecified-encoding) ------------------------------------------------------------------ Your code has been rated at 7.50/10 (previous run: 7.50/10, +0.00)
Expected behavior
We should not see the unspecified-encoding error because we are opening the file in binary mode. When I try to open the file with
with hello_txt.open("rb", encoding="utf-8") as stream:
I will get the following outputPylint version
OS / Environment
Mac and iterm2
Additional dependencies
astroid==2.8.0
isort==5.9.3
lazy-object-proxy==1.6.0
mccabe==0.6.1
platformdirs==2.3.0
pylint==2.11.0
toml==0.10.2
typing-extensions==3.10.0.2
wrapt==1.12.1
The text was updated successfully, but these errors were encountered: