﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
20815	daemonize.py: unbuffered text IO error (python3)	alex01@…	nobody	"When trying to run fcgi server I get ""ValueError: can't have unbuffered text I/O""

My python version and django version:
{{{
$ python --version
Python 3.2.3

>>> django.get_version()
'1.7.dev20130726184538'

Can't start server:
(virtenv02)jsmith@thinkpad01:~/virtenv02/mysite$ python manage.py runfcgi host=127.0.0.1 port=8100
Traceback (most recent call last):
  File ""manage.py"", line 10, in <module>
    execute_from_command_line(sys.argv)
  File ""/home/jsmith/virtenv02/django-trunk/django/core/management/__init__.py"", line 397, in execute_from_command_line
    utility.execute()
  File ""/home/jsmith/virtenv02/django-trunk/django/core/management/__init__.py"", line 390, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File ""/home/jsmith/virtenv02/django-trunk/django/core/management/base.py"", line 240, in run_from_argv
    self.execute(*args, **options.__dict__)
  File ""/home/jsmith/virtenv02/django-trunk/django/core/management/base.py"", line 283, in execute
    output = self.handle(*args, **options)
  File ""/home/jsmith/virtenv02/django-trunk/django/core/management/commands/runfcgi.py"", line 22, in handle
    runfastcgi(args)
  File ""/home/jsmith/virtenv02/django-trunk/django/core/servers/fastcgi.py"", line 176, in runfastcgi
    become_daemon(our_home_dir=options[""workdir""], **daemon_kwargs)
  File ""/home/jsmith/virtenv02/django-trunk/django/utils/daemonize.py"", line 28, in become_daemon
    so = open(out_log, 'a+', 0)
ValueError: can't have unbuffered text I/O
}}}
Server starts successfully and works if I give it daemonize=False option:
(virtenv02)jsmith@thinkpad01:~/virtenv02/mysite$ python manage.py runfcgi host=127.0.0.1 port=8100 daemonize=False

As far as I understand, this issue is specific to python3 and is related to changes in open function introduced in pep-3116

Alex"	Bug	closed	Python 3	dev	Normal	fixed	python3 runfcgi open		Accepted	0	0	0	0	0	0
