#🔒 how to save FULL error traceback in db

7 messages · Page 1 of 1 (latest)

lethal citrus
#

for example i want to save the following traceback

Traceback (most recent call last):
  File "/home/stenstikle/venv/lib/python3.12/site-packages/jishaku/features/python.py", line 190, in jsk_python
    async for send, result in AsyncSender(executor):  # type: ignore
  File "/home/stenstikle/venv/lib/python3.12/site-packages/jishaku/functools.py", line 124, in _internal
    value = await base.asend(self.send_value)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/stenstikle/venv/lib/python3.12/site-packages/jishaku/repl/compilation.py", line 210, in traverse
    async for send, result in AsyncSender(func_g(*self.args)):  # type: ignore
  File "/home/stenstikle/venv/lib/python3.12/site-packages/jishaku/functools.py", line 124, in _internal
    value = await base.asend(self.send_value)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<repl>", line 1, in _repl_coroutine
    [][0]
    ~~^^^
IndexError: list index out of range

into a db. How would I go about doing so? i’m not sure if pickle would work or maybe even json?

tough orioleBOT
#

@lethal citrus

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

lethal citrus
#

or I could just go down the redis route

lofty sail
#

you can get the string representation of the tracback, by using traceback.format_exc() in the except block

#
import traceback

...

try:
    ...
except Exception as e:
    s = traceback.format_exc()
    store_error(s)
    raise  # reraise, unless you know how to handle the error

...
tough orioleBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.