Exclude Databricks from notebook env (#17496)

This commit is contained in:
Sylvain Gugger 2022-06-01 09:00:11 -04:00 committed by GitHub
parent 3042ea4f6f
commit 6813439fdc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -460,6 +460,8 @@ def is_in_notebook():
raise ImportError("console")
if "VSCODE_PID" in os.environ:
raise ImportError("vscode")
if "DATABRICKS_RUNTIME_VERSION" in os.environ:
raise ImportError("databricks")
return importlib.util.find_spec("IPython") is not None
except (AttributeError, ImportError, KeyError):