From 3febb03bce965b943ea08556d71ebfa597fec705 Mon Sep 17 00:00:00 2001 From: Ian Huff Date: Mon, 22 Apr 2019 17:36:09 -0700 Subject: [PATCH] fix len error (#5421) --- news/2 Fixes/5420.md | 1 + pythonFiles/datascience/getJupyterVariableValue.py | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 news/2 Fixes/5420.md diff --git a/news/2 Fixes/5420.md b/news/2 Fixes/5420.md new file mode 100644 index 000000000000..6d4600f32ea1 --- /dev/null +++ b/news/2 Fixes/5420.md @@ -0,0 +1 @@ +Fix error with bad len() values in variable explorer \ No newline at end of file diff --git a/pythonFiles/datascience/getJupyterVariableValue.py b/pythonFiles/datascience/getJupyterVariableValue.py index 38ef30c89c70..82dcaa052acd 100644 --- a/pythonFiles/datascience/getJupyterVariableValue.py +++ b/pythonFiles/datascience/getJupyterVariableValue.py @@ -9,10 +9,16 @@ # Find shape and count if available if (hasattr(_VSCODE_evalResult, 'shape')): - _VSCODE_targetVariable['shape'] = str(_VSCODE_evalResult.shape) + try: + _VSCODE_targetVariable['shape'] = str(_VSCODE_evalResult.shape) + except TypeError: + pass if (hasattr(_VSCODE_evalResult, '__len__')): - _VSCODE_targetVariable['count'] = len(_VSCODE_evalResult) + try: + _VSCODE_targetVariable['count'] = len(_VSCODE_evalResult) + except TypeError: + pass # Get the string of the eval result, truncate it as it could be far too long _VSCODE_targetValue = str(_VSCODE_evalResult)