-2

I am new to python and was trying to do a web scraping project. I was referring to a code on github - main.py When I run the code I get this error. I tried to check spaces and tabs but I could not fix it. Can someone help me!

File "main.py", line 158 <<<<<<< HEAD ^IndentationError: expected an indented block

 def scrape_status(review):
        try:
            res = author.text.split('-')[0]
        except Exception:
            logger.warning('Failed to scrape employee_status')
            res = np.nan
        return res

    def scrape_rev_title(review):
        return review.find_element_by_class_name('summary').text.strip('"')

    def scrape_years(review):
<<<<<<< HEAD
        try:
            first_par = review.find_element_by_class_name(
                'reviewBodyCell').find_element_by_tag_name('p')
            if '(' in first_par.text:
                res = first_par.text[first_par.text.find('(') + 1:-1]
            else:
                res = np.nan
        except Exception:
=======
        first_par = review.find_element_by_class_name(
            'reviewBodyCell').find_element_by_tag_name('p')
        if '(' in first_par.text:
            res = first_par.text[first_par.text.find('(') + 1:-1]
        else:
>>>>>>> 7a5082d8ae61d93721d9ec8deb4ddda3d21cfb47
            res = np.nan
        return res

    def scrape_helpful(review):
        try:
<<<<<<< HEAD
            #helpful = review.find_element_by_class_name('count')
            helpful = review.find_element_by_class_name('voteHelpful').find_element_by_class_name('count').find_element_by_tag_name('span')
=======
            helpful = review.find_element_by_class_name('helpfulCount')
>>>>>>> 7a5082d8ae61d93721d9ec8deb4ddda3d21cfb47
            res = helpful[helpful.find('(') + 1: -1]
        except Exception:
            res = 0
        return res

    def expand_show_more(section):
        try:
            more_content = section.find_element_by_class_name('moreContent')
            more_link = more_content.find_element_by_class_name('moreLink')
            more_link.click()
        except Exception:
            pass
user3437212
  • 637
  • 1
  • 10
  • 20
  • 8
    You seem to have checked out a file in the middle of a [merge conflict](https://stackoverflow.com/questions/161813/how-to-resolve-merge-conflicts-in-git). You'll need to get that resolved somehow. –  Jul 24 '19 at 18:21
  • 1
    It appears you are trying to execute code that has merge conflicts – Bryan Oakley Jul 24 '19 at 18:21
  • 1
    `<<<<<<<< HEAD` is not a Python statement; it's a marker from `git`'s file comparator. – Prune Jul 24 '19 at 18:23
  • You might want to check the project your link is forked from instead. – chepner Jul 24 '19 at 18:27

1 Answers1

2

You have to remove these lines

<<<<<<< HEAD

=======

>>>>>>> 7a5082d8ae61d93721d9ec8deb4ddda3d21cfb47

<<<<<<< HEAD

=======

>>>>>>> 7a5082d8ae61d93721d9ec8deb4ddda3d21cfb47

These are likely due to git merge conflicts and not actual valid Python code.

Removing these lines would still not solve your problem. You have to resolve merge conflicts.

May Rest in Peace
  • 2,070
  • 2
  • 20
  • 34