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

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

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

PLE1507 Invalid type for initial `os.getenv` argument; expected `str`
  --> invalid_envvar_value.py:12:15
   |
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]
   |               ^^^^^^^^^
13 | os.getenv("PATH_TEST" if using_clear_path else "PATH_ORIG")
14 | os.getenv(1 if using_clear_path else "PATH_ORIG")
   |

PLE1507 Invalid type for initial `os.getenv` argument; expected `str`
  --> invalid_envvar_value.py:14:11
   |
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")
   |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
15 |
16 | AA = "aa"
   |
