Feature request #8343

Incremental output in python console

Added by Alexander Dunlap about 6 years ago. Updated about 6 years ago.

Status:Closed
Priority:Low
Assignee:-
Category:Python plugins
Pull Request or Patch supplied:No Resolution:
Easy fix?:No Copied to github as #:17127

Description

It would be great if the Python console showed script output as it were produced by the script, rather than waiting until the script finishes to display the output. This would allow one to monitor the progress of a script more easily. Also, if a script generates an exception, the exception is displayed at the top, above all of the output, which makes it hard to see that there has been an error if the script generates a lot of output.

UPDATE (duplicating bug because I couldn't reopen the old one #8270):

In a nightly build from a few days ago I see that exceptions are now displayed below output but I don't see incremental output. For example, when I run

import time
for i in xrange(3):
    time.sleep(1)
    print i

in the console, the script waits three seconds and then prints

0
1
2

rather than waiting 1 second, printing 0, waiting another second, printing 1, etc.

Associated revisions

Revision 3aad6df8
Added by Alexander J. Dunlap about 6 years ago

Update console_output.py

Call QCoreApplication.processEvents() after writing to Python console, enabling incremental output from Python scripts. Fixes #8343.

Revision 1302ecbe
Added by Nathan Woodrow about 6 years ago

Merge pull request #779 from ajdunlap/patch-1

Call QCoreApplication.processEvents() after writing to Python console. Fix #8343

Revision ae192e86
Added by Matthias Kuhn about 1 year ago

Make console printing safe

References #8343 https://issues.qgis.org/issues/8343

History

#1 Updated by Alexander Dunlap about 6 years ago

This can be fixed by adding QCoreApplication.processEvents() in the writeOut.write method in console_output.py.

#3 Updated by Nathan Woodrow about 6 years ago

  • Status changed from Open to Closed

Also available in: Atom PDF