Is there a mode of python that traces each line executed, similar to 'bash -x'?
<p>I am running a python script in crontab that works fine from the command line but appears to not be running at all when it runs in cron. If this was a bash script, I would add 'bash -x' to the crontab and pipe STOUT and STDERR to a log file. Is there a similar mode of python that will capture the execution of each individual line of code within a script?</p>

<p><a href="https://docs.python.org/2/library/trace.html" rel="nofollow">The trace module</a> does this.</p>

<pre><code>python -m trace --trace yourscript.py
</code></pre>

python debugging