@@ -134,14 +134,31 @@ def format_bbox(bbox_coords) -> str:
134134def emoji (text ):
135135 """Return emoji text for smart terminals, empty string for dumb/piped output.
136136
137- Uses Rich Console's built-in terminal detection.
137+ Uses Rich Console's built-in terminal detection plus additional checks
138+ for dumb terminals and Windows legacy console encoding issues.
138139
139140 Args:
140141 text: Emoji character(s) to display
141142
142143 Returns:
143144 The emoji text if capable terminal, empty string otherwise
144145 """
146+ import os
147+ import sys
148+
149+ # Check for dumb terminal
150+ if os .environ .get ("TERM" , "" ).lower () == "dumb" :
151+ return ""
152+
153+ # Check for Windows legacy console with cp1252 encoding
154+ if sys .platform == "win32" :
155+ try :
156+ encoding = sys .stdout .encoding or ""
157+ if encoding .lower () in ("cp1252" , "ascii" , "" ):
158+ return ""
159+ except Exception :
160+ return ""
161+
145162 # Rich Console automatically detects terminal capabilities
146163 # is_terminal is True if stdout is a TTY and not disabled
147164 return text if console .is_terminal else ""
@@ -667,6 +684,7 @@ def country_progress_callback(current: int, total: int, status: str = None):
667684 with tempfile .NamedTemporaryFile (
668685 mode = "w" , suffix = ".geojson" , delete = False
669686 ) as tmp :
687+ tmp .close ()
670688 country_gdf .to_file (tmp .name , driver = "GeoJSON" )
671689 country_geojson_file = tmp .name
672690
@@ -771,15 +789,15 @@ def country_progress_callback(current: int, total: int, status: str = None):
771789 tile_count = len (
772790 [(y , lon , lat ) for y , lon , lat in available_embeddings if y == year ]
773791 )
774- rprint (f"[cyan]π Tiles shown: { tile_count :,} (year { year } )[/cyan]" )
792+ rprint (f"[cyan]{ emoji ( 'π ' ) } Tiles shown: { tile_count :,} (year { year } )[/cyan]" )
775793 else :
776794 unique_tiles = len (
777795 set ((lon , lat ) for _ , lon , lat in available_embeddings )
778796 )
779797 years = sorted (set (y for y , _ , _ in available_embeddings ))
780- rprint (f"[cyan]π Unique tile locations: { unique_tiles :,} [/cyan]" )
798+ rprint (f"[cyan]{ emoji ( 'π ' ) } Unique tile locations: { unique_tiles :,} [/cyan]" )
781799 if years :
782- rprint (f"[cyan]π
Years covered: { min (years )} -{ max (years )} [/cyan]" )
800+ rprint (f"[cyan]{ emoji ( 'π
' ) } Years covered: { min (years )} -{ max (years )} [/cyan]" )
783801
784802 # Also generate JSON + HTML globe visualization
785803 rprint ("\n [blue]Generating interactive globe visualization...[/blue]" )
@@ -1138,7 +1156,7 @@ def format_bytes(b):
11381156 )
11391157
11401158 if not tiles_to_fetch :
1141- rprint ("[yellow]β οΈ No tiles found in the specified region.[/yellow]" )
1159+ rprint (f "[yellow]{ emoji ( ' β οΈ ' ) } No tiles found in the specified region.[/yellow]" )
11421160 rprint ("Try expanding your bounding box or checking data availability." )
11431161 return
11441162
@@ -1488,7 +1506,7 @@ def mark_file_complete(file_key):
14881506 )
14891507
14901508 except Exception as e :
1491- rprint (f"\n [red]β Error: { e } [/red]" )
1509+ rprint (f"\n [red]{ emoji ( 'β ' ) } Error: { e } [/red]" )
14921510 if verbose :
14931511 rprint ("\n [dim]Full traceback:[/dim]" )
14941512 console .print_exception ()
0 commit comments