---
source: crates/ruff_linter/src/rules/pylint/mod.rs
snapshot_kind: text
---
invalid_envvar_value.py:3:11: PLE1507 Invalid type for initial `os.getenv` argument; expected `str`
  |
1 | import os
2 | 
3 | os.getenv(1)  # [invalid-envvar-value]
  |           ^ PLE1507
4 | os.getenv("a")
5 | os.getenv("test")
  |

invalid_envvar_value.py:7:15: PLE1507 Invalid type for initial `os.getenv` argument; expected `str`
  |
5 | os.getenv("test")
6 | os.getenv(key="testingAgain")
7 | os.getenv(key=11)  # [invalid-envvar-value]
  |               ^^ PLE1507
8 | os.getenv(["hello"])  # [invalid-envvar-value]
9 | os.getenv(key="foo", default="bar")
  |

invalid_envvar_value.py:8:11: PLE1507 Invalid type for initial `os.getenv` argument; expected `str`
   |
 6 | os.getenv(key="testingAgain")
 7 | os.getenv(key=11)  # [invalid-envvar-value]
 8 | os.getenv(["hello"])  # [invalid-envvar-value]
   |           ^^^^^^^^^ PLE1507
 9 | os.getenv(key="foo", default="bar")
10 | os.getenv(key=f"foo", default="bar")
   |

invalid_envvar_value.py:12:15: PLE1507 Invalid type for initial `os.getenv` argument; expected `str`
   |
10 | os.getenv(key=f"foo", default="bar")
11 | os.getenv(key="foo" + "bar", default=1)
12 | os.getenv(key=1 + "bar", default=1)  # [invalid-envvar-value]
   |               ^^^^^^^^^ PLE1507
13 | os.getenv("PATH_TEST" if using_clear_path else "PATH_ORIG")
14 | os.getenv(1 if using_clear_path else "PATH_ORIG")
   |

invalid_envvar_value.py:14:11: PLE1507 Invalid type for initial `os.getenv` argument; expected `str`
   |
12 | os.getenv(key=1 + "bar", default=1)  # [invalid-envvar-value]
13 | os.getenv("PATH_TEST" if using_clear_path else "PATH_ORIG")
14 | os.getenv(1 if using_clear_path else "PATH_ORIG")
   |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLE1507
15 | 
16 | AA = "aa"
   |
