ConwayLife.com - A community for Conway's Game of Life and related cellular automata
Home  •  LifeWiki  •  Forums  •  Download Golly

Unable to flush stderr

Has something gone haywire? Let us know about it!

Unable to flush stderr

Postby Scorbie » September 11th, 2016, 11:35 am

I am using golly 2.8b1 and the following code results in an error.
import sys
sys.stderr.flush()
I couldn't get the unittest module to work because of this, but I gave up to use it anyway, so not too important.
Edit: the error message:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/scorbie/.golly/golly_clip.py", line 2, in <module>
    sys.stderr.flush()
AttributeError: StderrCatcher instance has no attribute 'flush'
Best wishes to you, Scorbie
User avatar
Scorbie
 
Posts: 1358
Joined: December 7th, 2013, 1:05 am

Re: Unable to flush stderr

Postby Andrew » September 13th, 2016, 11:15 pm

The error happens because Golly redefines sys.stderr to an internal class (StderrCatcher) that captures all error messages in a string that Golly can then display in a dialog box.

You could probably avoid the error by doing something like "sys.stderr.flush = pass" after importing sys.
User avatar
Andrew
Moderator
 
Posts: 678
Joined: June 2nd, 2009, 2:08 am
Location: Melbourne, Australia

Re: Unable to flush stderr

Postby Scorbie » September 16th, 2016, 10:40 am

Andrew wrote:You could probably avoid the error by doing something like "sys.stderr.flush = pass" after importing sys.
Ah! I'll try that next time. Thanks!
Best wishes to you, Scorbie
User avatar
Scorbie
 
Posts: 1358
Joined: December 7th, 2013, 1:05 am


Return to Bugs & Errors

Who is online

Users browsing this forum: No registered users and 3 guests