0

I'm hitting an error in a notebook and instead of showing a full call stack, it's a truncated stack with only the last few calls and the following message printed on top:

Output exceeds the size limit. Open the full output data *in a text editor*

Which links to a text file like:

{
    "name": "TypeError",
    "message": "default_collate: batch must contain tensors, numpy arrays, numbers, dicts or lists; found <class 'anndata._core.anndata.AnnData'>",
    "stack": "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[0;31mTypeError\u001b[0m                                 Traceback (most recent call last)\nFile \u001b[0;32m/usr/local/python/lib/python3.8/site-packages/torch/utils/data/_utils/collate.py:128\u001b[0m, in \u001b[0;36mcollate\u001b[0;34m(batch, collate_fn_map)\u001b[0m\n\u001b[1;32m    127\u001b[0m \u001b[39mtry\u001b[39;00m:\n\u001b[0;32m--> 128\u001b[0m     \u001b[39mreturn\u001b[39;00m elem_type({key: collate([d[key] \u001b[39mfor\u001b[39;00m d \u001b[39min\u001b[39;00m batch], collate_fn_map\u001b[39m=\u001b[39mcollate_fn_map) \u001b[39mfor\u001b[39;00m key \u001b[39min\u001b[39;00m elem})\n\u001b[1;32m    129\u001b[0m \u001

The issue is that ['stack'] is not a human-readable value.

How can I get a full call stack out of this, in human readable form?

Solomon Ucko
  • 5,724
  • 3
  • 24
  • 45
mkk
  • 879
  • 6
  • 19
  • 1
    Any chance you are using VSCode? You tagged 'Jupyter' in the categories and nowhere do you mention Visual Studio Code, but based on [this](https://stackoverflow.com/q/72823258/8508004) and [this](https://stackoverflow.com/a/68545882/8508004) and [this](https://github.com/microsoft/vscode-jupyter/issues/11691), it would seem not showing all the output is due to a setting you have in VScode. – Wayne Apr 16 '23 at 23:52
  • 1
    yes and that error size limit fixed this issue, thanks – mkk Apr 17 '23 at 00:25

1 Answers1

0

Try this:

with open(filename) as f:
    data = json.read(f)
print(data["stack"])
Solomon Ucko
  • 5,724
  • 3
  • 24
  • 45