{"record":{"id":"3ff3a5ccaa7c26f3","repo":"SeleniumHQ/selenium","slug":"module-name-r-has-no-attribute-name-r-3ff3a5","errorCode":null,"errorMessage":"module {__name__!r} has no attribute {name!r}","messagePattern":"module (.+?) has no attribute (.+?)","errorType":"exception","errorClass":"AttributeError","httpStatus":null,"severity":"error","filePath":"py/selenium/webdriver/ie/__init__.py","lineNumber":28,"sourceCode":"#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied.  See the License for the\n# specific language governing permissions and limitations\n# under the License.\n\nimport importlib\n\n_LAZY_SUBMODULES = [\"options\", \"service\", \"webdriver\"]\n\n\ndef __getattr__(name):\n    if name in _LAZY_SUBMODULES:\n        module = importlib.import_module(f\".{name}\", __name__)\n        globals()[name] = module\n        return module\n    raise AttributeError(f\"module {__name__!r} has no attribute {name!r}\")\n\n\ndef __dir__():\n    return sorted(_LAZY_SUBMODULES)\n","sourceCodeStart":10,"sourceCodeEnd":33,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/py/selenium/webdriver/ie/__init__.py#L10-L33","documentation":"Raised as AttributeError by the module-level __getattr__ in selenium.webdriver.ie when an attribute name is not one of the lazily-loaded submodules ('options', 'service', 'webdriver'). This is Python's standard lazy import mechanism — the IE driver modules are only imported on first access to reduce import overhead, and accessing any other name raises a standard AttributeError just as if the attribute never existed.","triggerScenarios":"Accessing selenium.webdriver.ie.SomeName where SomeName is not 'options', 'service', or 'webdriver'. This is standard Python attribute access behavior for a module using PEP 562 lazy loading.","commonSituations":"Typing a wrong module name (e.g., selenium.webdriver.ie.driver instead of selenium.webdriver.ie.webdriver). Trying to import a class directly from the package root instead of from its submodule. IDE auto-complete suggesting a non-existent name.","solutions":["Import from the correct submodule: from selenium.webdriver.ie.webdriver import WebDriver","Check the available names with dir(selenium.webdriver.ie) which returns ['options', 'service', 'webdriver']","Use the correct attribute name from the _LAZY_SUBMODULES list"],"exampleFix":"// before\nfrom selenium.webdriver import ie\ndriver = ie.driver  # AttributeError\n\n// after\nfrom selenium.webdriver.ie.webdriver import WebDriver\ndriver = WebDriver()","handlingStrategy":"validation","validationCode":"import selenium.webdriver.ie as ie\nif 'webdriver' in dir(ie):\n    from selenium.webdriver.ie.webdriver import WebDriver","typeGuard":"def is_lazy_submodule(name: str) -> bool:\n    return name in ('options', 'service', 'webdriver')","tryCatchPattern":"try:\n    from selenium.webdriver.ie import webdriver\nexcept AttributeError:\n    from selenium.webdriver.ie.webdriver import WebDriver","preventionTips":["Import directly from submodules: from selenium.webdriver.ie.webdriver import WebDriver","Check available names with dir(module) before attribute access","Avoid guessing submodule names"],"tags":["ie","lazy-loading","import","attribute-error","module"],"backgroundTag":null,"analyzedSha":"aa36b38e696a0909e973bdf5e2f9031ffe842c4b","analyzedAt":"2026-08-14T02:32:32.244Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}