Search code examples
pythonseleniumanacondaspyderindentation

Is there something issue in indentation, while using Anaconda's Spyder


from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

This code snippet pops an error of indentation while running in Anaconda's Spyder. This the below error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Panch\AppData\Local\Continuum\anaconda3\lib\site-packages\selenium\webdriver\__init__.py", line 18, in <module>
    from .firefox.webdriver import WebDriver as Firefox  # noqa
  File "C:\Users\Panch\AppData\Local\Continuum\anaconda3\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 29, in <module>
    from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver
  File "C:\Users\Panch\AppData\Local\Continuum\anaconda3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 27, in <module>
    from .remote_connection import RemoteConnection
  File "C:\Users\Panch\AppData\Local\Continuum\anaconda3\lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 34, in <module>
    from .errorhandler import ErrorCode
  File "C:\Users\Panch\AppData\Local\Continuum\anaconda3\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242
    raise exception_class(message, screen, stacktrace)
                                                     ^

IndentationError: unindent does not match any outer indentation level

Please let me know if anything I am missing out.


Solution

  • It is strange behavior but maybe somehow file selenium\webdriver\remote\errorhandler.py was broken.

    You can open this file in text editor which has function "convert tabs to spaces", use this function and save it back to the same file.