MatthewWolff/TwitterScraper

TabError: inconsistent use of tabs and spaces in indentation

Closed this issue · 4 comments

Hi. I created a Twitter developer's account, and filled in the details to api_key.py and removed the (example) portion. Running the script outputs this error:

  File "./scrape.py", line 105
    window_start, ids = start, set()
                                   ^
TabError: inconsistent use of tabs and spaces in indentation

I'm not sure what the problem is. I installed all the requirements, but for the Chrome webdriver, which resulted in a bunch of errors. But I have vanilla Google Chrome, and un-Googled Chromium installed, as well as vanilla Firefox. Using Linux Mint 19.3.

Thanks for the heads up. Had some weird unicode characters that I deleted before the last commit, didn't realize they messed with indentation. Fixed and pushed.

The previous issue is fixed, but I encounter another error when it attempts to scrape Tweets:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/common/service.py", line 76, in start
    stdin=PIPE)
  File "/usr/lib/python3.6/subprocess.py", line 729, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.6/subprocess.py", line 1364, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'chromedriver': 'chromedriver'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./scrape.py", line 204, in <module>
    user.scrape(begin, end, args.by, args.delay)
  File "./scrape.py", line 83, in scrape
    self.__find_tweets(start, end, by, loading_delay)
  File "./scrape.py", line 101, in __find_tweets
    with webdriver.Chrome() as driver:  # options are Chrome(), Firefox(), Safari()
  File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/chrome/webdriver.py", line 73, in __init__
    self.service.start()
  File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/common/service.py", line 83, in start
    os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
</pre>

did you change the code to not use chromedriver? you’ll have to edit the file itself for that, specifically line 101. If that doesn’t fix the problem, you should open a separate issue

Line 101 is: with webdriver.Chrome() as driver: # options are Chrome(), Firefox(), Safari()