Skip to content

Commit a133390

Browse files
adding the IPython NoneType handler condition
1 parent 8018270 commit a133390

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

python/tempo/utils.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,12 @@
1818

1919

2020
def __notdltruntime():
21-
user_namespace_keys = list(get_ipython().user_ns.keys())
22-
check_bool = (('create_dlt_table_fn' not in user_namespace_keys) and ('dlt_sql_fn' not in user_namespace_keys))
23-
return check_bool
21+
if type(get_ipython()) != type(None):
22+
user_namespace_keys = list(get_ipython().user_ns.keys())
23+
check_bool = (('create_dlt_table_fn' not in user_namespace_keys) and ('dlt_sql_fn' not in user_namespace_keys))
24+
return check_bool
25+
else:
26+
return False
2427

2528

2629
def __isnotebookenv():
@@ -70,6 +73,7 @@ def display_unavailable(df):
7073
if __notdltruntime():
7174
method = get_ipython().user_ns['display']
7275

76+
7377
# Under 'display' key in user_ns the original databricks display method is present
7478
# to know more refer: /databricks/python_shell/scripts/db_ipykernel_launcher.py
7579
def display_improvised(obj):

0 commit comments

Comments
 (0)