Modify

Opened 17 years ago

Closed 17 years ago

Last modified 11 years ago

#2666 closed defect (fixed)

NullOut instance has no attribute 'flush'

Reported by: zalkind Owned by: Markus Pelkonen
Priority: normal Component: TimeVisualizerPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.10

Description (last modified by Ryan J Ollos)

I tried 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)]]

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'

Attachments (1)

stdout_fix.patch (2.6 KB) - added by Markus Pelkonen 17 years ago.

Download all attachments as: .zip

Change History (11)

comment:1 Changed 17 years ago 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)]]

comment:2 in reply to:  1 Changed 17 years ago by anonymous

Replying to zalkind:

how can i edit the ticket?

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

Changed 17 years ago by Markus Pelkonen

Attachment: stdout_fix.patch added

comment:3 Changed 17 years ago by Markus Pelkonen

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...

comment:4 Changed 17 years ago by zalkind@…

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
Last edited 11 years ago by Ryan J Ollos (previous) (diff)

comment:5 Changed 17 years ago by zalkind@…

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

comment:6 in reply to:  5 ; Changed 17 years ago by Markus Pelkonen

Replying to zalkind@ipso.com.br:

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/raw-attachment/ticket/2666/stdout_fix.patch
patch -p0 <stdout_fix.patch
python setup.py install

Replying to zalkind@ipso.com.br:

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

Last edited 11 years ago by Ryan J Ollos (previous) (diff)

comment:7 in reply to:  6 ; Changed 17 years ago 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

comment:8 in reply to:  7 Changed 17 years ago by Markus Pelkonen

Replying to zalkind:

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.

comment:9 Changed 17 years ago by Markus Pelkonen

Resolution: fixed
Status: newclosed

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

comment:10 Changed 11 years ago by Ryan J Ollos

Description: modified (diff)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Markus Pelkonen.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.