Pretty debugging HTML for Python

After using the excellent Krumo package for PHP (perhaps the best known for using it in Drupal ), I was wondering if there was anything like that for Python.

In particular, I'm looking for a package that does the following: turns arbitrary (or almost arbitrary) Python variables into thematic HTML / CSS. Javascript component for smoothing various elements is preferred, but easy enough to write if necessary.

Is such a module available? I would prefer something autonomous, but if it exists only as part of another web structure, it would still be a good starting point.

+6
source share
2 answers

Since I could not find any existing libraries, I wrote Pymo . It is very similar to Krumo, providing any html Python variable that can be printed or saved to a file for viewing in a web browser, with javascript and CSS to make it readable.

Please take a look at it and send error messages or feature requests if this helps you.

+4
source

Maybe cgitb is what you are looking for:

The cgitb module provides a special exception handler for Python scripts. (His name is a little misleading. It was originally intended to display extensive tracing information in HTML for CGI scripts. It was later generalized to also display this information in plain text.) After activating this module, if an uncaught exception occurs, there will be A detailed formatted report is shown. The report includes a trace showing source code excerpts for each level, as well as how the values ​​of the arguments and local variables are currently in place to help you debug the problem. If you wish, you can save this information in a file, and do not send it to the browser.

0
source

Source: https://habr.com/ru/post/902907/


All Articles