1

When printing objects with many fields or large repr or str strings, I noticed in the PyCharm debugger that they frequently get truncated. For instance if we have

a = list(range(1000))
b = 1+2  # set breakpoint here

and in the interactive debugger call print(a) we get following output (newlines manually inserted), where the string is truncated and an ellipsis is added.

[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 
24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 
46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 
68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 
109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 
127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 
162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 
197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214,
 215, 216, 217, 218, 219, 220, 221,...

Is it possible to avoid this and get the full string?


Here the actual screenshot for demonstration:

enter image description here

flawr
  • 10,814
  • 3
  • 41
  • 71
  • Where exactly is the text truncated? In the debugger tool window? Or is it the terminal, console, run tool window, etc...? Because each of those windows has very different properties. – bad_coder May 05 '22 at 13:06
  • @bad_coder Thanks, I should have stated that: I'm referring to PyCharm's debugging console. – flawr May 05 '22 at 13:13
  • @flawr you mean [this window here](https://www.jetbrains.com/help/pycharm/part-1-debugging-python-code.html#start-debugger-session) right? And inside that window the console? Or just the debugger itself? Or the [console tool window](https://www.jetbrains.com/help/pycharm/interactive-console.html)? Sorry to be asking but as you can see the names overlap and each tool window has very different settings... In questions like this one a screenshot is priceless to let us know exactly which tab in which tool window is meant. – bad_coder May 05 '22 at 13:17
  • @bad_coder I'm sorry for my bad phrasing, I meant the console of the debugger, not the console-tool-window. I have added a screenshot! – flawr May 05 '22 at 13:30
  • @flawr no problem, it's very difficult to distinguish because of the overlap in names. I think [this post likely has the answer](https://stackoverflow.com/a/42610574) if not let us know in the comments and we'll look into it. – bad_coder May 05 '22 at 14:26
  • @bad_coder Thank you for the tip, unfortunately it didn't change anything for me even after restarting/turning that option on/off and changing its value. Thank you for your help and all your suggestions! – flawr May 06 '22 at 08:07
  • Maybe it's [PY-53807](https://youtrack.jetbrains.com/issue/PY-53807) I haven't tested all the possible solutions in the previously linked post. – bad_coder May 08 '22 at 11:13

0 Answers0