I'm using Notepad++'s NppExec plugin to execute Python scripts from within Notepad++. I notice that Python console output produced with the print() statement doesn't appear on the Notepad++ console until the entire script is finished executing. Is there a way to make print statements appear in real-time?

I'm using Notepad++ v.5.9.8 and NppExec v0.4.1.

link|improve this question
1  
Try python -u to run in an unbuffered mode. stackoverflow.com/questions/230751/… – jdigital Jan 24 at 23:44
@user8368 - Thanks, that worked perfectly. – Abiel Jan 25 at 2:01
@Abiel I can't believe this answer's been sitting here for 3 months!! I was looking for it all over Stack Overflow and I finally find it here :) – prrao Apr 20 at 2:24
feedback

1 Answer

The console window of NppExec is started as a child process, meaning that updating the display of the console window, as well as running the main program, are carried out on a single thread. By default, Python print statement outputs are buffered and run on the same thread as the parent script, so the output has to be displayed in unbuffered mode. This is done with the -u flag.

Use python -u script.py instead of the conventional python script.py, as can be seen in this SO question.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.