---
source: crates/ruff_linter/src/rules/pylint/mod.rs
---
PLW1501 `rwx` is not a valid mode for `open`
  --> bad_open_mode.py:11:12
   |
 9 | open(NAME, "+r", encoding="utf-8")
10 | open(NAME, "xb")
11 | open(NAME, "rwx")  # [bad-open-mode]
   |            ^^^^^
12 | open(NAME, mode="rwx")  # [bad-open-mode]
13 | open(NAME, "rwx", encoding="utf-8")  # [bad-open-mode]
   |

PLW1501 `rwx` is not a valid mode for `open`
  --> bad_open_mode.py:12:17
   |
10 | open(NAME, "xb")
11 | open(NAME, "rwx")  # [bad-open-mode]
12 | open(NAME, mode="rwx")  # [bad-open-mode]
   |                 ^^^^^
13 | open(NAME, "rwx", encoding="utf-8")  # [bad-open-mode]
14 | open(NAME, "rr", encoding="utf-8")  # [bad-open-mode]
   |

PLW1501 `rwx` is not a valid mode for `open`
  --> bad_open_mode.py:13:12
   |
11 | open(NAME, "rwx")  # [bad-open-mode]
12 | open(NAME, mode="rwx")  # [bad-open-mode]
13 | open(NAME, "rwx", encoding="utf-8")  # [bad-open-mode]
   |            ^^^^^
14 | open(NAME, "rr", encoding="utf-8")  # [bad-open-mode]
15 | open(NAME, "+", encoding="utf-8")  # [bad-open-mode]
   |

PLW1501 `rr` is not a valid mode for `open`
  --> bad_open_mode.py:14:12
   |
12 | open(NAME, mode="rwx")  # [bad-open-mode]
13 | open(NAME, "rwx", encoding="utf-8")  # [bad-open-mode]
14 | open(NAME, "rr", encoding="utf-8")  # [bad-open-mode]
   |            ^^^^
15 | open(NAME, "+", encoding="utf-8")  # [bad-open-mode]
16 | open(NAME, "xw", encoding="utf-8")  # [bad-open-mode]
   |

PLW1501 `+` is not a valid mode for `open`
  --> bad_open_mode.py:15:12
   |
13 | open(NAME, "rwx", encoding="utf-8")  # [bad-open-mode]
14 | open(NAME, "rr", encoding="utf-8")  # [bad-open-mode]
15 | open(NAME, "+", encoding="utf-8")  # [bad-open-mode]
   |            ^^^
16 | open(NAME, "xw", encoding="utf-8")  # [bad-open-mode]
17 | open(NAME, "ab+")
   |

PLW1501 `xw` is not a valid mode for `open`
  --> bad_open_mode.py:16:12
   |
14 | open(NAME, "rr", encoding="utf-8")  # [bad-open-mode]
15 | open(NAME, "+", encoding="utf-8")  # [bad-open-mode]
16 | open(NAME, "xw", encoding="utf-8")  # [bad-open-mode]
   |            ^^^^
17 | open(NAME, "ab+")
18 | open(NAME, "a+b")
   |

PLW1501 `Ua` is not a valid mode for `open`
  --> bad_open_mode.py:22:12
   |
20 | open(NAME, "+rUb")
21 | open(NAME, "x+b")
22 | open(NAME, "Ua", encoding="utf-8")  # [bad-open-mode]
   |            ^^^^
23 | open(NAME, "Ur++", encoding="utf-8")  # [bad-open-mode]
24 | open(NAME, "Ut", encoding="utf-8")
   |

PLW1501 `Ur++` is not a valid mode for `open`
  --> bad_open_mode.py:23:12
   |
21 | open(NAME, "x+b")
22 | open(NAME, "Ua", encoding="utf-8")  # [bad-open-mode]
23 | open(NAME, "Ur++", encoding="utf-8")  # [bad-open-mode]
   |            ^^^^^^
24 | open(NAME, "Ut", encoding="utf-8")
25 | open(NAME, "Ubr")
   |

PLW1501 `rwx` is not a valid mode for `open`
  --> bad_open_mode.py:32:25
   |
30 | pathlib.Path(NAME).open("wb")
31 | pathlib.Path(NAME).open(mode)
32 | pathlib.Path(NAME).open("rwx")  # [bad-open-mode]
   |                         ^^^^^
33 | pathlib.Path(NAME).open(mode="rwx")  # [bad-open-mode]
34 | pathlib.Path(NAME).open("rwx", encoding="utf-8")  # [bad-open-mode]
   |

PLW1501 `rwx` is not a valid mode for `open`
  --> bad_open_mode.py:33:30
   |
31 | pathlib.Path(NAME).open(mode)
32 | pathlib.Path(NAME).open("rwx")  # [bad-open-mode]
33 | pathlib.Path(NAME).open(mode="rwx")  # [bad-open-mode]
   |                              ^^^^^
34 | pathlib.Path(NAME).open("rwx", encoding="utf-8")  # [bad-open-mode]
   |

PLW1501 `rwx` is not a valid mode for `open`
  --> bad_open_mode.py:34:25
   |
32 | pathlib.Path(NAME).open("rwx")  # [bad-open-mode]
33 | pathlib.Path(NAME).open(mode="rwx")  # [bad-open-mode]
34 | pathlib.Path(NAME).open("rwx", encoding="utf-8")  # [bad-open-mode]
   |                         ^^^^^
35 |
36 | import builtins
   |

PLW1501 `Ua` is not a valid mode for `open`
  --> bad_open_mode.py:37:21
   |
36 | import builtins
37 | builtins.open(NAME, "Ua", encoding="utf-8")
   |                     ^^^^
   |
