This repository was archived by the owner on Apr 1, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2323import re
2424import sys
2525import textwrap
26+ import traceback
2627import typing
2728from typing import (
2829 Any ,
@@ -856,11 +857,12 @@ def _repr_html_(self) -> str:
856857 import traitlets # noqa: F401
857858
858859 from bigframes import display
859- except ImportError :
860+ except (AttributeError , ValueError , ImportError ):
861+ # Fallback if anywidget is not available
860862 warnings .warn (
861- "anywidget or its dependencies are not installed . "
863+ "Anywidget mode is not available . "
862864 "Please `pip install anywidget traitlets` or `pip install 'bigframes[anywidget]'` to use interactive tables. "
863- "Falling back to deferred mode."
865+ f "Falling back to deferred mode. Error: { traceback . format_exc () } "
864866 )
865867 return formatter .repr_query_job (self ._compute_dry_run ())
866868
Original file line number Diff line number Diff line change @@ -203,21 +203,19 @@ def _reset_batches_for_new_page_size(self):
203203
204204 def _set_table_html (self ):
205205 """Sets the current html data based on the current page and page size."""
206- # For empty dataframe, render empty table with headers.
207- if self .row_count == 0 :
208- page_data = self ._cached_data
209- else :
210- start = self .page * self .page_size
211- end = start + self .page_size
212-
213- # fetch more data if the requested page is outside our cache
214- cached_data = self ._cached_data
215- while len (cached_data ) < end and not self ._all_data_loaded :
216- if self ._get_next_batch ():
217- cached_data = self ._cached_data
218- else :
219- break
220- page_data = cached_data .iloc [start :end ]
206+ start = self .page * self .page_size
207+ end = start + self .page_size
208+
209+ # fetch more data if the requested page is outside our cache
210+ cached_data = self ._cached_data
211+ while len (cached_data ) < end and not self ._all_data_loaded :
212+ if self ._get_next_batch ():
213+ cached_data = self ._cached_data
214+ else :
215+ break
216+
217+ # Get the data for the current page
218+ page_data = cached_data .iloc [start :end ]
221219
222220 # Generate HTML table
223221 self .table_html = bigframes .display .html .render_html (
You can’t perform that action at this time.
0 commit comments