#20815: daemonize.py: unbuffered text IO error (python3)
--------------------------------------+------------------------------------
     Reporter:  alex01@…              |                    Owner:  nobody
         Type:  Bug                   |                   Status:  new
    Component:  Python 3              |                  Version:  master
     Severity:  Normal                |               Resolution:
     Keywords:  python3 runfcgi open  |             Triage Stage:  Accepted
    Has patch:  0                     |      Needs documentation:  0
  Needs tests:  0                     |  Patch needs improvement:  0
Easy pickings:  0                     |                    UI/UX:  0
--------------------------------------+------------------------------------

Comment (by dk+django@…):

 Replying to [comment:1 claudep]:
 > Maybe someone more knowledgeable about buffered/unbuffered output may
 chime in to enlighten us?

 Change it to
  {{{open( out_log, 'a+', 1)}}}
 This buffers up to the next EOL, which makes sense for log files. (Same
 for {{{err_log}}})

 As per [https://docs.python.org/3/library/functions.html#open Python3
 docs]:
 > buffering is an optional integer used to set the buffering policy. Pass
 0 to switch buffering off (only allowed in binary mode), 1 to select line
 buffering (only usable in text mode)

 Looking at [https://docs.python.org/2/library/functions.html#open open()
 in Python2], line buffering should also work:
  - If something goes wrong while writing to {{{out_log}}}, you get an
 exception
  - I haven't yet seen {{{traceback}}} failing in the middle of a line, so
 it is probably also safe for {{{err_log}}}

 Hope this helps.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/20815#comment:4>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/074.eb78cf31834a02190a18c22ee338fb67%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to