Skip to content

Commit 21d28f9

Browse files
Merge pull request #5422 from Microsoft/dev/ianhu/releaseFixLenIssue
fix len error (#5421)
2 parents d84b3de + 649433d commit 21d28f9

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

news/2 Fixes/5420.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix error with bad len() values in variable explorer

pythonFiles/datascience/getJupyterVariableValue.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,16 @@
99

1010
# Find shape and count if available
1111
if (hasattr(_VSCODE_evalResult, 'shape')):
12-
_VSCODE_targetVariable['shape'] = str(_VSCODE_evalResult.shape)
12+
try:
13+
_VSCODE_targetVariable['shape'] = str(_VSCODE_evalResult.shape)
14+
except TypeError:
15+
pass
1316

1417
if (hasattr(_VSCODE_evalResult, '__len__')):
15-
_VSCODE_targetVariable['count'] = len(_VSCODE_evalResult)
18+
try:
19+
_VSCODE_targetVariable['count'] = len(_VSCODE_evalResult)
20+
except TypeError:
21+
pass
1622

1723
# Get the string of the eval result, truncate it as it could be far too long
1824
_VSCODE_targetValue = str(_VSCODE_evalResult)

0 commit comments

Comments
 (0)