# Ticket #2666 (closed defect: fixed)

Opened 5 years ago

## NullOut instance has no attribute 'flush'

Reported by: Assigned to: zalkind mape normal TimeVisualizerPlugin normal 0.10

### Description

I tryed this macros:

Error: Failed to load processor BurnDown
No macro or processor named 'BurnDown' found

Error: Failed to load processor BurnDown
No macro or processor named 'BurnDown' found

Error: Failed to load processor BurnDown
No macro or processor named 'BurnDown' found

Error: Failed to load processor BurnDown
No macro or processor named 'BurnDown' found

and with all of them i got this error:

Oops...

Trac detected an internal error: NullOut? instance has no attribute 'flush'

Traceback (most recent call last):

File "/home/hxd/trac/share/trac/cgi-bin/trac.cgi", line 20, in ?

cgi_frontend.run()

File "/home/hxd/trac/lib/python2.4/site-packages/trac/web/cgi_frontend.py", line 68, in run

gateway.run(dispatch_request)

File "/home/hxd/trac/lib/python2.4/site-packages/trac/web/wsgi.py", line 87, in run

response = application(self.environ, self._start_response)

File "/home/hxd/trac/lib/python2.4/site-packages/trac/web/main.py", line 440, in dispatch_request

req.send_error(sys.exc_info(), status=500)

File "/home/hxd/trac/lib/python2.4/site-packages/trac/web/api.py", line 394, in send_error

exc_info)

File "/home/hxd/trac/lib/python2.4/site-packages/trac/web/main.py", line 406, in dispatch_request

dispatcher.dispatch(req)

File "/home/hxd/trac/lib/python2.4/site-packages/trac/web/main.py", line 237, in dispatch

resp = chosen_handler.process_request(req)

File "build/bdist.linux-i686/egg/tractimevisualizerplugin/pluginwrapper.py", line 31, in process_request File "build/bdist.linux-i686/egg/tractimevisualizerplugin/impl.py", line 417, in process_request File "/home/hxd/trac/lib/python2.4/site-packages/trac/web/api.py", line 460, in write

self._write(data)

File "/home/hxd/trac/lib/python2.4/site-packages/trac/web/cgi_frontend.py", line 44, in _write

sys.stdout.flush()

AttributeError?: NullOut? instance has no attribute 'flush'

## Change History

### (follow-up: ↓ 2 ) 03/02/08 06:56:30 changed by zalkind

how can i edit the ticket?

i was suposed to write this macros:

[[BurnDown(width=800,height=200,query=targetmilestone=milestone1&datestart=08/8/07&dateend=8/22/08)]]
[[BurnDown(width=400,height=200,query=targetmilestone=milestone1&datestart=08/8/07&dateend=8/15/08)]]
[[BurnDown(width=400,height=200,query=targetmilestone=milestone1&datestart=08/15/07&dateend=8/22/08)]]
[[BurnDown(width=600,height=200,query=targetmilestone=milestone1&dateend=8/31/08)]]


### (in reply to: ↑ 1 ) 03/02/08 21:45:57 changed by anonymous

how can i edit the ticket?

U can't because we don't have TICKET_ADMIN rights at Trac hacks...

### 03/02/08 22:43:43 changed by mape

Traceback (most recent call last):
File "/home/hxd/trac/share/trac/cgi-bin/trac.cgi", line 20, in ?
cgi_frontend.run()
File "/home/hxd/trac/lib/python2.4/site-packages/trac/web/cgi_frontend.py", line 68, in run
gateway.run(dispatch_request)
File "/home/hxd/trac/lib/python2.4/site-packages/trac/web/wsgi.py", line 87, in run
response = application(self.environ, self._start_response)
File "/home/hxd/trac/lib/python2.4/site-packages/trac/web/main.py", line 440, in dispatch_request
req.send_error(sys.exc_info(), status=500)
File "/home/hxd/trac/lib/python2.4/site-packages/trac/web/api.py", line 394, in send_error
exc_info)
File "/home/hxd/trac/lib/python2.4/site-packages/trac/web/main.py", line 406, in dispatch_request
dispatcher.dispatch(req)
File "/home/hxd/trac/lib/python2.4/site-packages/trac/web/main.py", line 237, in dispatch
resp = chosen_handler.process_request(req)
File "build/bdist.linux-i686/egg/tractimevisualizerplugin/pluginwrapper.py", line 31, in process_request
File "build/bdist.linux-i686/egg/tractimevisualizerplugin/impl.py", line 417, in process_request
File "/home/hxd/trac/lib/python2.4/site-packages/trac/web/api.py", line 460, in write
self._write(data)
File "/home/hxd/trac/lib/python2.4/site-packages/trac/web/cgi_frontend.py", line 44, in _write
sys.stdout.flush()
AttributeError: NullOut instance has no attribute 'flush'


It seems that for (some unknown reason) sys.out doesn't get reseted even explicitly requested. My implementation sets it globally before try clause ( impl.py#L403) and restores it in finally clause ( impl.py#L421).

I didn't ever face this problem... i use mod_python though... Unfortunately I'm not sure how python implements try-finally... It may be in your case that req.write at line 417 goes to NullOut?, thus the exception. I just don't understand why my runtime handles finally block first - it doesn't make much sense. Maybe it is mod python - it doesn't use std.out for output...

I can't reproduce the issue. attachment:stdout_fix.patch may fix this issue - or then not (at least it didn't break my setup). Please let me know if this pach helped, I could merge it to tagged version.

I have lots of nice new features in 0.7 which is almost out - this issue probably affects it too, thus I aprepriate if you tell me about results...

### 03/03/08 03:06:11 changed by zalkind@ipso.com.br

I don't know if i did anything wrong, but i got this error after the modifications:

Traceback (most recent call last):

File "/home/hxd/trac/lib/python2.4/site-packages/trac/web/main.py", line 406, in dispatch_request

dispatcher.dispatch(req)

File "/home/hxd/trac/lib/python2.4/site-packages/trac/web/main.py", line 237, in dispatch

resp = chosen_handler.process_request(req)

File "build/bdist.linux-i686/egg/tractimevisualizerplugin/pluginwrapper.py", line 26, in process_request File "/home/hxd/trac/lib/python2.4/site-packages/TracTimeVisualizerPlugin-0.6-py2.4.egg/tractimevisualizerplugin/impl.py", line 397

req.send_response(200)

SyntaxError?: invalid syntax

### (follow-up: ↓ 6 ) 03/03/08 03:17:43 changed by zalkind@ipso.com.br

I forgot to say. It compiled and installed well. by the way, i am using cgi.

### (in reply to: ↑ 5 ; follow-up: ↓ 7 ) 03/06/08 09:47:22 changed by mape

I don't know if i did anything wrong, but i got this error after the modifications

I tried this myself... and of course patching failed in linux... I spent few hours figuring out what could be the reason. Finally I remembered that Trac code base is using svn-eol: native directive... And yes, the problem was that patch program removed windows line endings from patch and tried to patch against source having windows eol... So I set svn eol in [3317] and now patching should work - no matter where patch is made...

I also changed repository layout in [3316], because I probably need to make small fixes based on feedback from community. So now you should be able to reproduce steps identifically in the way I did it:

svn co http://trac-hacks.org/svn/timevisualizerplugin/branches/TimeVisualizer_0.6
cd TimeVisualizer_0.6
wget -O stdout_fix.patch http://trac-hacks.org/attachment/ticket/2666/stdout_fix.patch?format=raw
patch -p0 <stdout_fix.patch
python setup.py install


by the way, i am using cgi.

I've not tried CGI myself... probably I should but unfortunately I dont' have that much spare time... So please try the patch with above commands and tell me about results.

br,
Markus

### (in reply to: ↑ 6 ; follow-up: ↓ 8 ) 03/06/08 12:22:31 changed by zalkind

Markus,

Thank you so much, it is working now.

I was almost ashamed on bothering you.

Now i will study your code to see if i can contribute making two different lines: ideal burndown and actual burndown (just if you already didn,t do it).

Thanks and congratulations,

Zalkind

### (in reply to: ↑ 7 ) 03/06/08 20:47:35 changed by mape

Now i will study your code to see if i can contribute making two different lines: ideal burndown and actual burndown (just if you already didn,t do it).

Sorry, that is not available in current 0.6 release... it is in 0.7 version, which is on my laptop hard drive... It is quite total rewrite, thus I need to maturize it a while untill I consider releasing... hmm, or should I do it as 0.7 beta or something? I'll consider.

### 03/07/08 18:01:29 changed by mape

• status changed from new to closed.
• resolution set to fixed.

(In [3323]) Applied patch, which fixes logging issue with cgi frontend, closes #2666

### Add/Change #2666 (NullOut instance has no attribute 'flush')

Change Properties