1

I am running Python 2.7.3 and Django 1.5.8. I am trying to get “It worked” for a new install. I get Error 324 from Chrome:

Unable to load the webpage because the server sent no data.
Error code: ERR_EMPTY_RESPONSE

When I kill the server, I get the following traceback:

0 errors found
June 02, 2014 - 06:39:55
Django version 1.5.8, using settings 'fed1.settings.dev'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
♥Unhandled exception in thread started by <bound method Command.inner_run of     <django.contrib.staticfiles.management.commands.runserver.Command object at 0x19fd950>>

Traceback (most recent call last):
File "/home/vagrant/fed1-venv/local/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 115, in inner_run
ipv6=self.use_ipv6, threading=threading)
File "/home/vagrant/fed1-venv/local/lib/python2.7/site-packages/django/core/servers/basehttp.py", line 186, in run
httpd.serve_forever()
File "/usr/lib/python2.7/SocketServer.py", line 225, in serve_forever
r, w, e = select.select([self], [], [], poll_interval)
AttributeError: 'NoneType' object has no attribute 'select'

I read somewhere that this error had to do with Python 2.5.1 and was gone in 2.5.2. I can’t find that now. It must have been somewhere in code.djangoproject.com, but perhaps this is not the same issue.

I saw How to 'clear' the port when restarting django runserver where people said the server was already running, so I tried that solution:

(fed1-venv)vagrant@precise64:/vagrant/fed1$ ps aux | grep -i manage
vagrant  10113  0.0  0.2  11676   940 pts/0    S+   14:57   0:00 grep --color=auto -i manage

And then tried bringing it to the foreground to kill but:

(fed1-venv)vagrant@precise64:/vagrant/fed1$ fg
bash: fg: current: no such job

So that is not my problem, either.

Django - Strange behavior using static files has a similar error resolved with URL patterns – but I’m not there yet. I’m just trying to get ‘it worked’. Most of the people I see asking about this error have sites up and running in production already.

I looked at socketserver.py but I'm not advanced enough to interpret that.

Community
  • 1
  • 1
Malik A. Rumi
  • 1,361
  • 2
  • 17
  • 31

1 Answers1

4

Don't worry about the exception, you can safely ignore it. Your server has exited already, albeit a little messily.

On shut-down, Python cleans up global names to prevent circular dependencies from holding up finalisation. It does so by rebinding them no None.

You were shutting down the server with a Keyboard Interrupt (CTRL-C), triggering finalisation. In the meantime, the serve_forever thread was still running it's socket polling loop, but the select global in the SocketServer module had already been rebound. As a result the lookup for select.select() fails.

If this bothers you, upgrade to Python 3.4. This version no longer sets globals to None (in most cases), as per Safe Object Finalization; see PEP 442.

As for your Chrome error code and your other question, something is already bound to the port you are trying to use for Django. That's an entirely separate issue from the exception you saw for the select.select() call. It could be that another piece of software is holding on to that port, something that doesn't respond to HTTP requests (leading to the Chrome error response).

See Determining what process is bound to a port (Linux) or Who is listening on a given TCP port on Mac OS X? (Mac) to troubleshoot that issue.

Community
  • 1
  • 1
Martijn Pieters
  • 889,049
  • 245
  • 3,507
  • 2,997
  • I followed the link you gave for determining what process is bound to a port, ran netstat but there was nothing on either port 8000 or 8888. I decided to try closing my VM and rebooting. This time when I ran runserver Chrome still says there is no response, but when I closed the server there was no error output from the console at all. I guess that's good if it shows the select error is resolved, but I have no idea where to go next with the 'no response' issue. – Malik A. Rumi Jun 02 '14 at 19:55
  • p.s. Maybe I should add/explain that 8888 is the port vagrant forwards to. – Malik A. Rumi Jun 12 '14 at 16:37