Processing 2.0.3 Writing to Console unpredictable

edited November 2013 in Using Processing

Hello, I've noticed that whenever I write to the console, I don't see the console update right away the way it used to on Processing 1.5-ish and prior. It could be an OS thing (I'm running Mavericks OSX 10.9 on a MacBookPro) but wanted to throw this out to the forum.

The below piece of code updates the Window title with every click, but the console println updates sporadically the same info, often going many clicks before it will update. Often the only way to get the latest console update is by bringing mouse focus to the console. Any thoughts?

// Console update
int cnt;
void setup(){
  noLoop();
  cnt = 0;
  size (400,100);
}
void draw(){}

void mousePressed() {
  cnt++;
  String msg = ("click! " + cnt);
  frame.setTitle(msg);
  print (msg + "\t");
}
Tagged:

Answers

  • Tested in 2.0.0 and 2.1 on Windows 7, I haven't seen the issue.

  • This may not be related, but I often mislead myself by opening several Processing windows. Then when in one of them I'm running a sketch, if I click on another Processing window, the console output of the running sketch will move to this other window.

    Both in 2.0.3 and 1.5.1 on Windows 7.

  • try println() rather than print() - might be an output flushing problem

  • Thank you for the suggestions. When tested, I was running just the simple sketch. Also I did try println, but same behaviour...Could anyone out there running Mavericks OS try running the sketch? Just curious. Thanks again.

  • Answer ✓

    Hi, I have noticed the same thing.. once I updated to Mavericks OSX I experience the same problem.

    Console output isn't realtime unless the console has focus... prior to Mavericks this was not a problem.

  • It may be unrelated, but it is bad practice to not have size as the first statement in setup (sets mode), it is usual to put noLoop at the end of setup.

  • Noted, Monkstone. You are correct. It's good to see that someone is having the same console issue in Mavericks. Can anything be done about it? Thanks all

  • Answer ✓

    I have also noticed the same thing in mavericks

  • edited November 2013 Answer ✓

    I believe that I have a solution... Mavericks updated the operating system with certain power saving tweaks... one of which is the way applications can be 'put to sleep' to conserve power when they are not the focus.

    I believe that this is what is happening with the delayed console output.

    Do the following to disable 'app nap' for Processing.

    how to disable app nap in mavericks

    I have done this and now it seems to update the console correctly.

  • Thank you for that tip d4vx...I was about to try that, but I just happened to upgrade to Processing 2.1, and this version does not seem to have that problem anymore...Good tip to keep in mind, though.

  • excellent!

  • Hmm. Sorry to bump this old topic but I still encounter into this problem.

    I have the latest Processing 3.2.3 and I can only see the output console update on the focus of the sketch window.

    This simple sketch already gives me problems:

    void setup() {
      size(200, 200);
      frameRate(10);
    }
    
    void draw() {
      print("la");
    }
    

    I am using OS X El Capitan 10.11.6. I tried disabling "App nap" but it had no effect. (Also restarted Processing, still no change.)

    Anyone else with this issue? Hard to find this on the web!

Sign In or Register to comment.