When I populate a list with more than 300 elements the working environment I'm using to read Python which is Pycharm will only show the first 300 elements. This applies to both the community editions and the professional edition. Does anyone know how to fix this and if not does anyone know of an IDE which can display all the elements of a list, even if that list has 10,000 elements?
Again I want to emphasize that for debugging purposes I need to be able to view the elements of a list.
This shows that more than 300 elements cannot be viewed
This shows the length of the list in question.
Yes, it's possible to show more items with pycharm.
Look at file helpers/pydev/_pydevd_bundle/pydevd_resolver.py
Edit the MAX_ITEMS_TO_HANDLE
to whatever you need.
# Note: 300 is already a lot to see in the outline (after that the user should really use the shell to get things)
# and this also means we'll pass less information to the client side (which makes debugging faster).
MAX_ITEMS_TO_HANDLE = 500
You don't need to restart IDE after the change, just rerun the script.
For Windows 10, the file can be found at Program Files/JetBrains/PyCharm <version>/helpers/pydev/_pydevd_bundle/pydevd_resolver.py
When I need to inspect long list in debugger I print out the variable with "Evaluate expression" (or alt + F8).
You will get into the command window.
And then you find your variable in the console window.
you can add one or more watches for the remainder of the list, having a list such as:
my_huge_list = '0' * 1000
then add a watch for my_huge_list[300:]
and then my_huge_list[600:]
and so on.
It's not super pretty or convenient, but it does work. I'm pretty sure that this can be somehow scripted into pycharm, but my current list has no more than 450 items so this won't be worth it this time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With