I have the following code: try: None except Exception as e: status_code = "error" # Try to extract status from exception if hasattr(e, "status_code"): status_code = str(e.status_code) PyLance throws the following warning: Cannot access attribute "status_code" for class "Exception" I use the "standard" type checking mode. Why is this warning thrown and how can I remove it without explicitly using a type ignore? Continue reading...