Yotam
Yotam

Reputation: 10685

Is there a way to get (python) script output while running using org-mode

I'm writing small bits of code inside org-mode files. This bits of code are slow (copy files from remote machines) and I wish to see how the copy progress (sometimes the connection to the remote machine fails and I wish to know). For that, I want to print the serial number of the currently accessed file.

Org-mode's code-block have two problems with this:

  1. It places the either the printed messages or the returned variable in the results part of the block.
  2. It does so only once the code ends.

Is there a way to get the printed output to a separated, live variable?

Upvotes: 4

Views: 506

Answers (1)

juandesant
juandesant

Reputation: 753

Reopening sys.stdout so that it is flushed should help.

See How to flush output of Python print?, and this blog post:

http://algorithmicallyrandom.blogspot.com.es/2009/10/python-tips-and-tricks-flushing-stdout.html

Upvotes: 0

Related Questions