Popular recipes by Dirk Holtwick http://code.activestate.com/recipes/users/98196/2001-06-25T05:00:24-07:00ActiveState Code RecipesDebug with garbage collection (Python)
2001-06-25T04:46:01-07:00Dirk Holtwickhttp://code.activestate.com/recipes/users/98196/http://code.activestate.com/recipes/65333-debug-with-garbage-collection/
<p style="color: grey">
Python
recipe 65333
by <a href="/recipes/users/98196/">Dirk Holtwick</a>
(<a href="/recipes/tags/debugging/">debugging</a>).
</p>
<p>You now that there is garbage in your program but you don't know what exactly. In this piece of code additionaly to the normal debugging output of gc the object itself are shown to get an idea where the leak may be.</p>
Traceback that does'nt output on sys.stderr (Python)
2001-06-25T04:25:48-07:00Dirk Holtwickhttp://code.activestate.com/recipes/users/98196/http://code.activestate.com/recipes/65332-traceback-that-doesnt-output-on-sysstderr/
<p style="color: grey">
Python
recipe 65332
by <a href="/recipes/users/98196/">Dirk Holtwick</a>
(<a href="/recipes/tags/cgi/">cgi</a>).
</p>
<p>For CGI programmers it's important to display tracebacks in the HTML pages to debug their scripts, but the usual functions in the modules cgi and traceback print to sys.sterr. So this small programm returns the traceback as a string an can even add entities for HTML.</p>
Use good old INI files for configuration (Python)
2001-06-25T05:00:24-07:00Dirk Holtwickhttp://code.activestate.com/recipes/users/98196/http://code.activestate.com/recipes/65334-use-good-old-ini-files-for-configuration/
<p style="color: grey">
Python
recipe 65334
by <a href="/recipes/users/98196/">Dirk Holtwick</a>
(<a href="/recipes/tags/extending/">extending</a>).
</p>
<p>Many people use Python modules as config files, but this way your program may be manipulated or an syntax error may come into that file. Try the small script here to use the good old INI config files, known from Windows.</p>
How long this thread is already running? (Python)
2001-06-22T07:32:13-07:00Dirk Holtwickhttp://code.activestate.com/recipes/users/98196/http://code.activestate.com/recipes/65288-how-long-this-thread-is-already-running/
<p style="color: grey">
Python
recipe 65288
by <a href="/recipes/users/98196/">Dirk Holtwick</a>
(<a href="/recipes/tags/threads/">threads</a>).
</p>
<p>The threading module of Python is quite nice to use, but sometimes you'd like to know how long your tasks are already running, so you may react on long running threads. In my example I tried to make creating usual threads more easy also.</p>