|
|
<!DOCTYPE html> |
|
|
<html class="writer-html5" lang="en" > |
|
|
<head> |
|
|
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" /> |
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
|
|
<title>Debug — pyTermTk 0.36.0-a |
|
|
documentation</title> |
|
|
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> |
|
|
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" /> |
|
|
<link rel="stylesheet" href="../_static/theme_overrides.css" type="text/css" /> |
|
|
<link rel="stylesheet" href="../_static/ttk.css" type="text/css" /> |
|
|
<link rel="shortcut icon" href="https://ceccopierangiolieugenio.github.io/pyTermTk/sandbox/www/favicon.ico"/> |
|
|
<!--[if lt IE 9]> |
|
|
<script src="../_static/js/html5shiv.min.js"></script> |
|
|
<![endif]--> |
|
|
|
|
|
<script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script> |
|
|
<script src="../_static/jquery.js"></script> |
|
|
<script src="../_static/underscore.js"></script> |
|
|
<script src="../_static/_sphinx_javascript_frameworks_compat.js"></script> |
|
|
<script src="../_static/doctools.js"></script> |
|
|
<script src="../_static/js/theme.js"></script> |
|
|
<link rel="index" title="Index" href="../genindex.html" /> |
|
|
<link rel="search" title="Search" href="../search.html" /> |
|
|
<link rel="next" title="Cross Compatibility" href="features/crosscompatible.html" /> |
|
|
<link rel="prev" title="Installation" href="installing.html" /> |
|
|
</head> |
|
|
|
|
|
<body class="wy-body-for-nav"> |
|
|
<div class="wy-grid-for-nav"> |
|
|
<nav data-toggle="wy-nav-shift" class="wy-nav-side"> |
|
|
<div class="wy-side-scroll"> |
|
|
<div class="wy-side-nav-search" > |
|
|
<a href="../index.html" class="icon icon-home"> pyTermTk |
|
|
</a> |
|
|
<div role="search"> |
|
|
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get"> |
|
|
<input type="text" name="q" placeholder="Search docs" /> |
|
|
<input type="hidden" name="check_keywords" value="yes" /> |
|
|
<input type="hidden" name="area" value="default" /> |
|
|
</form> |
|
|
</div> |
|
|
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu"> |
|
|
<p class="caption" role="heading"><span class="caption-text">Tutorials</span></p> |
|
|
<ul> |
|
|
<li class="toctree-l1"><a class="reference internal" href="../tutorial/000-examples.html">pyTermTk - < <strong>the Examples</strong> ></a></li> |
|
|
<li class="toctree-l1"><a class="reference internal" href="../tutorial/001-helloworld.html">pyTermTk - Hello World</a></li> |
|
|
<li class="toctree-l1"><a class="reference internal" href="../tutorial/002-layout.html">pyTermTk - Layouts</a></li> |
|
|
<li class="toctree-l1"><a class="reference internal" href="../tutorial/003-signalslots.html">pyTermTk - Signal & Slots</a></li> |
|
|
<li class="toctree-l1"><a class="reference internal" href="../tutorial/004-logging.html">pyTermTk - Logging</a></li> |
|
|
<li class="toctree-l1"><a class="reference internal" href="../tutorial/005-calculator.html">pyTermTk - Your first Calculator</a></li> |
|
|
<li class="toctree-l1"><a class="reference internal" href="../tutorial/ttkDesigner/textEdit/README.html">ttkDesigner - Your first TextEditor</a></li> |
|
|
</ul> |
|
|
<p class="caption" role="heading"><span class="caption-text">Stuff</span></p> |
|
|
<ul class="current"> |
|
|
<li class="toctree-l1"><a class="reference internal" href="features/index.html">Features</a></li> |
|
|
<li class="toctree-l1"><a class="reference internal" href="installing.html">Installation</a></li> |
|
|
<li class="toctree-l1"><a class="reference internal" href="installing.html#quickstart">Quickstart</a></li> |
|
|
<li class="toctree-l1 current"><a class="current reference internal" href="#">Debug</a><ul> |
|
|
<li class="toctree-l2"><a class="reference internal" href="#notes-and-tips-about-debugging">Notes and tips about debugging</a><ul> |
|
|
<li class="toctree-l3"><a class="reference internal" href="#env-variables">Env Variables</a><ul> |
|
|
<li class="toctree-l4"><a class="reference internal" href="#termtk-file-log-log-to-a-file"><strong>TERMTK_FILE_LOG</strong> - Log to a file</a></li> |
|
|
<li class="toctree-l4"><a class="reference internal" href="#termtk-stacktrace-force-stacktrace-generation-with-ctrl-c"><strong>TERMTK_STACKTRACE</strong> - Force stacktrace generation with CTRL+C</a></li> |
|
|
</ul> |
|
|
</li> |
|
|
<li class="toctree-l3"><a class="reference internal" href="#gui">Gui</a><ul> |
|
|
<li class="toctree-l4"><a class="reference internal" href="#id1">Visual Studio Code</a></li> |
|
|
<li class="toctree-l4"><a class="reference internal" href="#id2">intellij IDEA</a></li> |
|
|
<li class="toctree-l4"><a class="reference internal" href="#id3">PyCharm</a></li> |
|
|
</ul> |
|
|
</li> |
|
|
<li class="toctree-l3"><a class="reference internal" href="#profiling">Profiling</a><ul> |
|
|
<li class="toctree-l4"><a class="reference internal" href="#id4">VizTracer</a></li> |
|
|
<li class="toctree-l4"><a class="reference internal" href="#cprofile-cprofilev">cProfile, cProfilev</a></li> |
|
|
<li class="toctree-l4"><a class="reference internal" href="#id5">py-spy</a></li> |
|
|
<li class="toctree-l4"><a class="reference internal" href="#pyroscope">pyroscope</a></li> |
|
|
</ul> |
|
|
</li> |
|
|
</ul> |
|
|
</li> |
|
|
</ul> |
|
|
</li> |
|
|
<li class="toctree-l1"><a class="reference internal" href="features/crosscompatible.html">Cross Compatibility</a></li> |
|
|
</ul> |
|
|
<p class="caption" role="heading"><span class="caption-text">API Reference</span></p> |
|
|
<ul> |
|
|
<li class="toctree-l1"><a class="reference internal" href="../autogen.TermTk/TermTk.TTkAbstract.html">TermTk.TTkAbstract</a></li> |
|
|
<li class="toctree-l1"><a class="reference internal" href="../autogen.TermTk/TermTk.TTkCore.html">TermTk.TTkCore</a></li> |
|
|
<li class="toctree-l1"><a class="reference internal" href="../autogen.TermTk/TermTk.TTkCore.TTkTerm.html">TermTk.TTkCore.TTkTerm</a></li> |
|
|
<li class="toctree-l1"><a class="reference internal" href="../autogen.TermTk/TermTk.TTkGui.html">TermTk.TTkGui</a></li> |
|
|
<li class="toctree-l1"><a class="reference internal" href="../autogen.TermTk/TermTk.TTkLayouts.html">TermTk.TTkLayouts</a></li> |
|
|
<li class="toctree-l1"><a class="reference internal" href="../autogen.TermTk/TermTk.TTkTemplates.html">TermTk.TTkTemplates</a></li> |
|
|
<li class="toctree-l1"><a class="reference internal" href="../autogen.TermTk/TermTk.TTkTestWidgets.html">TermTk.TTkTestWidgets</a></li> |
|
|
<li class="toctree-l1"><a class="reference internal" href="../autogen.TermTk/TermTk.TTkTheme.html">TermTk.TTkTheme</a></li> |
|
|
<li class="toctree-l1"><a class="reference internal" href="../autogen.TermTk/TermTk.TTkTypes.html">TermTk.TTkTypes</a></li> |
|
|
<li class="toctree-l1"><a class="reference internal" href="../autogen.TermTk/TermTk.TTkUiTools.html">TermTk.TTkUiTools</a></li> |
|
|
<li class="toctree-l1"><a class="reference internal" href="../autogen.TermTk/TermTk.TTkWidgets.html">TermTk.TTkWidgets</a></li> |
|
|
<li class="toctree-l1"><a class="reference internal" href="../autogen.TermTk/TermTk.TTkWidgets.TTkModelView.html">TermTk.TTkWidgets.TTkModelView</a></li> |
|
|
<li class="toctree-l1"><a class="reference internal" href="../autogen.TermTk/TermTk.TTkWidgets.TTkPickers.html">TermTk.TTkWidgets.TTkPickers</a></li> |
|
|
</ul> |
|
|
|
|
|
</div> |
|
|
</div> |
|
|
</nav> |
|
|
|
|
|
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" > |
|
|
<i data-toggle="wy-nav-top" class="fa fa-bars"></i> |
|
|
<a href="../index.html">pyTermTk</a> |
|
|
</nav> |
|
|
|
|
|
<div class="wy-nav-content"> |
|
|
<div class="rst-content"> |
|
|
<div role="navigation" aria-label="Page navigation"> |
|
|
<ul class="wy-breadcrumbs"> |
|
|
<li><a href="../index.html" class="icon icon-home"></a> »</li> |
|
|
<li>Debug</li> |
|
|
<li class="wy-breadcrumbs-aside"> |
|
|
<a href="../_sources/info/debug.rst.txt" rel="nofollow"> View page source</a> |
|
|
</li> |
|
|
</ul> |
|
|
<hr/> |
|
|
</div> |
|
|
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> |
|
|
<div itemprop="articleBody"> |
|
|
|
|
|
<section id="debug"> |
|
|
<h1>Debug<a class="headerlink" href="#debug" title="Permalink to this heading"></a></h1> |
|
|
<section id="notes-and-tips-about-debugging"> |
|
|
<h2>Notes and tips about debugging<a class="headerlink" href="#notes-and-tips-about-debugging" title="Permalink to this heading"></a></h2> |
|
|
<section id="env-variables"> |
|
|
<h3>Env Variables<a class="headerlink" href="#env-variables" title="Permalink to this heading"></a></h3> |
|
|
<p>There are few ENV Variables that can be used to force some debugging features;</p> |
|
|
<section id="termtk-file-log-log-to-a-file"> |
|
|
<h4><strong>TERMTK_FILE_LOG</strong> - Log to a file<a class="headerlink" href="#termtk-file-log-log-to-a-file" title="Permalink to this heading"></a></h4> |
|
|
<p>To force logging to a file (i.e. “<strong>session.log</strong>”)</p> |
|
|
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="nv">TERMTK_FILE_LOG</span><span class="o">=</span>session.log python3 demo/demo.py |
|
|
</pre></div> |
|
|
</div> |
|
|
</section> |
|
|
<section id="termtk-stacktrace-force-stacktrace-generation-with-ctrl-c"> |
|
|
<h4><strong>TERMTK_STACKTRACE</strong> - Force stacktrace generation with CTRL+C<a class="headerlink" href="#termtk-stacktrace-force-stacktrace-generation-with-ctrl-c" title="Permalink to this heading"></a></h4> |
|
|
<p>Use this env variable to force a stacktrace generation to the file defined (i.e. “<strong>stacktrace.txt</strong>”)</p> |
|
|
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="nv">TERMTK_STACKTRACE</span><span class="o">=</span>stacktrace.txt python3 demo/demo.py |
|
|
</pre></div> |
|
|
</div> |
|
|
</section> |
|
|
</section> |
|
|
<section id="gui"> |
|
|
<h3>Gui<a class="headerlink" href="#gui" title="Permalink to this heading"></a></h3> |
|
|
<section id="id1"> |
|
|
<h4><a class="reference external" href="https://code.visualstudio.com">Visual Studio Code</a><a class="headerlink" href="#id1" title="Permalink to this heading"></a></h4> |
|
|
<p>vsCode debug feature comes out of the box, it only require the default <a class="reference external" href="https://marketplace.visualstudio.com/items?itemName=ms-python.python">**Python**</a> extension installed</p> |
|
|
<img alt="vsCode debug" src="https://github.com/ceccopierangiolieugenio/pyTermTk/assets/8876552/00eab373-c347-45ab-8c40-0b023135946c" /> |
|
|
</section> |
|
|
<section id="id2"> |
|
|
<h4><a class="reference external" href="https://www.jetbrains.com/help/idea/python.html">intellij IDEA</a><a class="headerlink" href="#id2" title="Permalink to this heading"></a></h4> |
|
|
<p>I haven’t tried it recently since my vsCode experience is silk smooth but based on the results of the <a class="reference external" href="https://github.com/ceccopierangiolieugenio/pyTermTk/issues/102">issue 102</a> I am pretty confident that intellij debug feature should work as well</p> |
|
|
</section> |
|
|
<section id="id3"> |
|
|
<h4><a class="reference external" href="https://www.jetbrains.com/pycharm/">PyCharm</a><a class="headerlink" href="#id3" title="Permalink to this heading"></a></h4> |
|
|
<p>Same for PyCharm, I mean, I tried both those IDEs at least once.</p> |
|
|
</section> |
|
|
</section> |
|
|
<section id="profiling"> |
|
|
<h3>Profiling<a class="headerlink" href="#profiling" title="Permalink to this heading"></a></h3> |
|
|
<section id="id4"> |
|
|
<h4><a class="reference external" href="https://pypi.org/project/viztracer/">VizTracer</a><a class="headerlink" href="#id4" title="Permalink to this heading"></a></h4> |
|
|
<img alt="https://github.com/ceccopierangiolieugenio/pyTermTk/assets/8876552/34ff9b77-f01b-45bd-a57e-971c7b68c4a2" src="https://github.com/ceccopierangiolieugenio/pyTermTk/assets/8876552/34ff9b77-f01b-45bd-a57e-971c7b68c4a2" /> |
|
|
<p>this tool is able to generate a tracker file that can be viewed using <a class="reference external" href="https://perfetto.dev">Perfetto</a> (<a class="reference external" href="https://ui.perfetto.dev/">UI</a>)</p> |
|
|
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="c1"># install cprofilev:</span> |
|
|
<span class="c1"># pip3 install viztracer</span> |
|
|
viztracer --tracer_entries <span class="m">10000010</span> tests/paint.py |
|
|
|
|
|
<span class="c1"># View the results</span> |
|
|
<span class="c1"># loading the "result.json" in https://ui.perfetto.dev</span> |
|
|
<span class="c1"># or running</span> |
|
|
vizviewer result.json |
|
|
</pre></div> |
|
|
</div> |
|
|
</section> |
|
|
<section id="cprofile-cprofilev"> |
|
|
<h4><a class="reference external" href="https://docs.python.org/3/library/profile.html">cProfile</a>, <a class="reference external" href="https://github.com/ymichael/cprofilev">cProfilev</a><a class="headerlink" href="#cprofile-cprofilev" title="Permalink to this heading"></a></h4> |
|
|
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>python3 -m cProfile -o profiler.bin tests/test.ui.004.py |
|
|
|
|
|
<span class="c1"># install cprofilev:</span> |
|
|
<span class="c1"># pip3 install cprofilev</span> |
|
|
cprofilev -f profiler.bin |
|
|
<span class="c1"># open http://127.0.0.1:4000</span> |
|
|
</pre></div> |
|
|
</div> |
|
|
</section> |
|
|
<section id="id5"> |
|
|
<h4><a class="reference external" href="https://github.com/benfred/py-spy">py-spy</a><a class="headerlink" href="#id5" title="Permalink to this heading"></a></h4> |
|
|
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="c1"># install</span> |
|
|
pip install py-spy |
|
|
|
|
|
<span class="c1"># run the application</span> |
|
|
python3 demo/demo.py |
|
|
|
|
|
<span class="c1"># on another terminal run the py-spy</span> |
|
|
sudo env <span class="s2">"PATH=</span><span class="nv">$PATH</span><span class="s2">"</span> <span class="se">\</span> |
|
|
py-spy top <span class="se">\</span> |
|
|
--pid <span class="k">$(</span>ps -A -o pid,cmd <span class="p">|</span> grep demo.py <span class="p">|</span> grep -v grep <span class="p">|</span> sed <span class="s1">'s,python.*,,'</span><span class="k">)</span> |
|
|
</pre></div> |
|
|
</div> |
|
|
</section> |
|
|
<section id="pyroscope"> |
|
|
<h4>pyroscope<a class="headerlink" href="#pyroscope" title="Permalink to this heading"></a></h4> |
|
|
<p><a class="reference external" href="https://pyroscope.io/">pyroscope</a> can be used as well (I guess) for profiling</p> |
|
|
</section> |
|
|
</section> |
|
|
</section> |
|
|
</section> |
|
|
|
|
|
|
|
|
</div> |
|
|
</div> |
|
|
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer"> |
|
|
<a href="installing.html" class="btn btn-neutral float-left" title="Installation" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a> |
|
|
<a href="features/crosscompatible.html" class="btn btn-neutral float-right" title="Cross Compatibility" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a> |
|
|
</div> |
|
|
|
|
|
<hr/> |
|
|
|
|
|
<div role="contentinfo"> |
|
|
<p>© Copyright 2021, Eugenio Parodi.</p> |
|
|
</div> |
|
|
|
|
|
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a |
|
|
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a> |
|
|
provided by <a href="https://readthedocs.org">Read the Docs</a>. |
|
|
|
|
|
|
|
|
</footer> |
|
|
</div> |
|
|
</div> |
|
|
</section> |
|
|
</div> |
|
|
<script> |
|
|
jQuery(function () { |
|
|
SphinxRtdTheme.Navigation.enable(true); |
|
|
}); |
|
|
</script> |
|
|
|
|
|
</body> |
|
|
</html> |