We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 53154a5 commit 7a573c7Copy full SHA for 7a573c7
1 file changed
datalab_kernel/workspace.py
@@ -502,8 +502,15 @@ def remove(self, name: str) -> None:
502
if panel is None:
503
raise KeyError(f"Object '{name}' not found")
504
505
- # Select the object by title and remove it
506
- self.proxy.select_objects([name], panel=panel)
+ # Get object titles to find the 1-based index
+ titles = self.proxy.get_object_titles(panel=panel)
507
+ try:
508
+ obj_num = titles.index(name) + 1 # 1-based index
509
+ except ValueError:
510
+ raise KeyError(f"Object '{name}' not found") from None
511
+
512
+ # Select the object by number (1-based index) and remove it
513
+ self.proxy.select_objects([obj_num], panel=panel)
514
515
# Try different methods depending on DataLab version
516
# DataLab 1.1+ has call_method, older versions don't support individual remove
0 commit comments