Search code examples
pythondjangoselenium

WSGIServerException: [Errno 8] nodename nor servname provided, or not known


I am getting this error intermittently but when it happens my automated integration testing using Django's LiveServerTestCase comes to a screeching halt throwing the following error:

WSGIServerException: [Errno 8] nodename nor servname provided, or not known

The failure comes as soon as the main test class is instantiated from any given test (this happens after the in-memory db is created and my fixtures are loaded).

My setup is as follows:

  • Mac OSX Snow leopard
  • Django 1.4.1
  • Virtual environment (housing all Python libraries)
  • sqlite (for testing) MySQL/InnoDB for production
  • Local Git branches housing code

So far, this error only occurs while testing on our LAN at my office. At home, tests run just fine but then again tests run fine at my work for a time, hence the intermittent frustration.

In the vein of troubleshooting I have created a new virtualenv, removed all .pyc files system wide, reinstalled MySQL from source as well as all required libraries.

If anyone has come across this error and knows how to beat it, please share.

Thanks


Solution

  • Sounds like it might be a network issue. Check that you have a consistent internet connection (e.g. by pinging an appropriate server continuously as you run the tests), and that your DNS server is consistently reporting results (e.g. not randomly dropping requests or timing out).

    You could also try changing the live server address to a straight IP address (e.g. change localhost to 127.0.0.1), so that it doesn't have to perform an address lookup.