Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] rich_tracebacks with rich_tracebacks not working in notebook #3215

Open
2 tasks done
NewUserHa opened this issue Nov 25, 2023 · 1 comment
Open
2 tasks done

Comments

@NewUserHa
Copy link

Describe the bug

import logging
import json
import rich.progress
import rich.logging


logging.basicConfig(
    handlers=[rich.logging.RichHandler(
        rich_tracebacks=True, log_time_format="[%X]")],
)


with rich.progress.Progress(speed_estimate_period=60) as PROGRESS:
    task = PROGRESS.add_task("123", total=3)

    for _ in range(3):
        try:
            r = json.loads('error')
        except:
            logging.exception('error')

        PROGRESS.advance(task, 1)
        await asyncio.sleep(1)

when rich_tracebacks = False, logging.exception works in both cmd and vscode notebook.
when rich_tracebacks = True, logging.exception works in cmd. But not in vscode notebook, the progress is working but the exception will disappear immediately

Platform

Click to expand
╭──────────────────────── <class 'rich.console.Console'> ────────────────────────╮
 A high level console interface.                                                
                                                                                
 ╭────────────────────────────────────────────────────────────────────────────╮ 
  <console width=115 ColorSystem.TRUECOLOR>                                   
 ╰────────────────────────────────────────────────────────────────────────────╯ 
                                                                                
     color_system = 'truecolor'                                                 
         encoding = 'utf-8'                                                     
             file = <ipykernel.iostream.OutStream object at 0x000001C7A3A02E60> 
           height = 100                                                         
    is_alt_screen = False                                                       
 is_dumb_terminal = False                                                       
   is_interactive = False                                                       
       is_jupyter = True                                                        
      is_terminal = False                                                       
   legacy_windows = False                                                       
         no_color = False                                                       
          options = ConsoleOptions(                                             
                        size=ConsoleDimensions(width=115, height=100),          
                        legacy_windows=False,                                   
                        min_width=1,                                            
                        max_width=115,                                          
                        is_terminal=False,                                      
                        encoding='utf-8',                                       
                        max_height=100,                                         
                        justify=None,                                           
                        overflow=None,                                          
                        no_wrap=False,                                          
                        highlight=None,                                         
                        markup=None,                                            
                        height=None                                             
                    )                                                           
            quiet = False                                                       
           record = False                                                       
         safe_box = True                                                        
             size = ConsoleDimensions(width=115, height=100)                    
        soft_wrap = False                                                       
           stderr = False                                                       
            style = None                                                        
         tab_size = 8                                                           
            width = 115                                                         
╰────────────────────────────────────────────────────────────────────────────────╯
Copy link

Thank you for your issue. Give us a little time to review it.

PS. You might want to check the FAQ if you haven't done so already.

This is an automated reply, generated by FAQtory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant