Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I normally deal with issues like this through the <code>logging</code> module in the standard library, which is quite good, but I'll assume you have good reason for wanting this.</p> <p>I would be surprised if the PyDev console supported full terminal emulation. At least under Helios on Windows, I've had no problem with Unicode display, but terminal escapes are another matter.</p> <p>If you know specifically which terminal you want to use, you can run <code>sleep 3600</code> in it and then do this in your test driver:</p> <pre><code>import sys def redirect_terminal(ttypath): term = open(ttypath, 'w+') sys.stdout = term sys.stderr = term </code></pre> <p>Trying this in the interactive interpreter, which will likely be a bit different from running it in PyDev, I get this in the initial terminal (note local echo and prompt still returned here):</p> <pre><code>&gt;&gt;&gt; redirect_terminal('/dev/pts/0') &gt;&gt;&gt; dir() &gt;&gt;&gt; raise TypeError &gt;&gt;&gt; </code></pre> <p>and this in the <code>/dev/pts/0</code> terminal:</p> <pre><code>['__builtins__', '__doc__', '__name__', '__package__', 'redirect_terminal', 'sys'] Traceback (most recent call last): File "&lt;stdin&gt;", line 1, in &lt;module&gt; TypeError </code></pre> <p>While I did not try any terminal escapes here, they are just byte sequences that get printed like any other, so they should be printed on the remote terminal.</p> <p>I cannot manage to collect input from a different terminal in the interactive interpreter. When I try, input is still read from the initial terminal.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload