Skip to content

rocky-d/dttb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dttb

license lint test codecov pypi-v pypi-dm sponsors

python uv ruff ty

DateTime TraceBack

Installation

  • uv
uv add dttb
  • pip
pip install dttb

Usage

  • demo1.py
import dttb

dttb.apply()

1 / 0
[2026-01-15 22:37:09.882049]
Traceback (most recent call last):
  File "demo1.py", line 5, in <module>
    1 / 0
ZeroDivisionError: division by zero
  • demo2.py
import dttb
import threading
import time

dttb.apply()


def func(seconds):
    time.sleep(seconds)
    seconds / 0


thread1 = threading.Thread(target=func, kwargs={"seconds": 1})
thread2 = threading.Thread(target=func, kwargs={"seconds": 2})
thread1.start()
thread2.start()
thread1.join()
thread2.join()

func(seconds=3)
[2026-01-15 23:00:03.048290]
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/**/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/**/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "demo2.py", line 10, in func
    seconds / 0
ZeroDivisionError: division by zero
[2026-01-15 23:00:04.048362]
Exception in thread Thread-2:
Traceback (most recent call last):
  File "/**/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/**/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "demo2.py", line 10, in func
    seconds / 0
ZeroDivisionError: division by zero
[2026-01-15 23:00:07.055083]
Traceback (most recent call last):
  File "demo2.py", line 20, in <module>
    func(seconds=3)
  File "demo2.py", line 10, in func
    seconds / 0
ZeroDivisionError: division by zero