Skip to content

rpt.list_bookmarks() error #971

@ricky7uio

Description

@ricky7uio

Describe the bug
I see an error, ie:
ValueError: 🔴 Invalid page display name. The 'ReportSectiond3d9087492b6d2c08b53' page does not exist in the 'XXXXXX' report within the 'XXXXXXX' workspace.

it seems that if a bookmark contains a reference to an old page that doesn't exist in the report anymore it presents this error.

I know this shouldn't be the case but that is exactly the use case I was trying to get from this module. I wanted to see if there where old or broken references within our current bookmarks. I was actually looking for old model references in the bookmarks but this example that I found references to deleted pages is also very useful.

Would be possible to return the information but highlighting that there is reference to a non existent page?

Thank you Michael.

To Reproduce
Steps to reproduce the behavior:
run the module that contains a bookmark that has as activesection property a deleted page.

Expected behavior
Still return the df but highlight issue with some of the bookmarks.

Screenshots
N/A

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Additional context
Full error but hiding workspace and report names:

ValueError Traceback (most recent call last)
Cell In[37], line 1
----> 1 rpt.list_bookmarks()

File ~/cluster-env/trident_env/lib/python3.11/site-packages/sempy_labs/report/_reportwrapper.py:1759, in ReportWrapper.list_bookmarks(self)
1755 suppress_display = payload.get("options", {}).get("suppressDisplay", False)
1756 apply_only_to_target_visuals = payload.get("options", {}).get(
1757 "applyOnlyToTargetVisuals", False
1758 )
-> 1759 (page_id, page_display) = self._resolve_page_name_and_display_name(
1760 rpt_page_id
1761 )
1763 for rptPg in payload.get("explorationState", {}).get("sections", {}):
1764 for visual_name in (
1765 payload.get("explorationState", {})
1766 .get("sections", {})
1767 .get(rptPg, {})
1768 .get("visualContainers", {})
1769 ):

File ~/cluster-env/trident_env/lib/python3.11/site-packages/sempy_labs/report/_reportwrapper.py:509, in ReportWrapper._resolve_page_name_and_display_name(self, page)
494 def resolve_page_name_and_display_name(self, page: str) -> Tuple[str, str]:
495 """
496 Obtains the page name, page display name for a given page in a report.
497
(...)
506 The page name and display name.
507 """
--> 509 (
, page_id, page_name) = self.__resolve_page_name_and_display_name_file_path(
510 page
511 )
513 return (page_id, page_name)

File ~/cluster-env/trident_env/lib/python3.11/site-packages/sempy_labs/report/_reportwrapper.py:490, in ReportWrapper.__resolve_page_name_and_display_name_file_path(self, page)
488 return path, page_id, page
489 else:
--> 490 raise ValueError(
491 f"{icons.red_dot} Invalid page display name. The '{page}' page does not exist in the '{self._report_name}' report within the '{self._workspace_name}' workspace."
492 )

ValueError: 🔴 Invalid page display name. The 'ReportSectiond3d9087492b6d2c08b53' page does not exist in the 'XXXXXX' report within the 'XXXXXXXXX' workspace.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions