This is because you are using raise
without providing an exception or instance type.
According to the documentation :
The only argument to raise indicates an exception. This must be either an instance of an exception or an exception class (a class that derives from an exception).
Demo:
>>> raise Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: exceptions must be old-style classes or derived from BaseException, not NoneType >>> raise ValueError('Failed to get Firefox Webdriver') Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: Failed to get Firefox Webdriver
Note that raise
with no arguments can be used inside the except
block to except
exception.
FYI, in python3 instead it will be:
>>> raise Traceback (most recent call last): File "<stdin>", line 1, in <module> RuntimeError: No active exception to reraise
source share