Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bad status line exception while opening a page on django development server

I am executing selenium test cases via Proboscis, for good reporting of test results. I have the following test case written

from selenium import webdriver 
from selenium.webdriver.common.keys import Keys
from proboscis import test
import unittest
driver = webdriver.Firefox()

@test(groups=["unit","login"])
class UI_test(unittest.TestCase):

    def test_SuccessfulErrorMsgOnEmptyUserName(self):
        driver.get("http://127.0.0.1:7999/login/")
        username_input = driver.find_element_by_id("id_email")
        username_input.send_keys('')
        password_input = driver.find_element_by_id("id_password")
        password_input.send_keys('bill3')
        driver.find_element_by_xpath('//input[@value = "Log In"]').click()
        driver.implicitly_wait(3)
        driver.find_element_by_class_name("error-login")

driver.close()  

def run_tests():
    from proboscis import TestProgram
   # from tests import unit

    # Run Proboscis and exit.
    TestProgram().run_and_exit()

if __name__ == '__main__':
    run_tests() 

What could be causing the BadStatusLine exception in this code?

like image 721
Dania Avatar asked Jan 22 '13 06:01

Dania


People also ask

How do I run a Django development server?

The built-in development server is part of what the manage.py file offers in any Django Project. To run the development server you'll want to navigate to the project directory that holds your Django project. This can be done right from Visual Studio code if you like by clicking Terminal-> New Terminal like so.

How do I know if Django server is running?

To verify the Django project, make sure your virtual environment is activated, then start Django's development server using the command python manage.py runserver . The server runs on the default port 8000, and you see output like the following output in the terminal window: Performing system checks...

How do I disable Django?

Though the message in the console states that Ctrl+Break should be used to quit the server, it is not possible; one can only use Ctrl+F4 works to close the console.


1 Answers

Looks like a duplicate of Python/Django "BadStatusLine" error but i can't flag due to this question having a bounty. According to this answer, a BadStatusLine exception is likely caused by an empty response, as in there being no status line at all.

According to this answer, the server formally tells the client there is no more data, instead of simply causing a connection reset or rude timeout.

like image 94
Cees Timmerman Avatar answered Oct 20 '22 10:10

Cees Timmerman