Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in scrape_facebook_page function #6

Open
ElHong opened this issue Dec 7, 2019 · 2 comments
Open

Error in scrape_facebook_page function #6

ElHong opened this issue Dec 7, 2019 · 2 comments

Comments

@ElHong
Copy link

ElHong commented Dec 7, 2019

Hi,
I'm trying to execute the scraper on my machine (MacBook Pro - 10.15.1). I'm using Jupyter notebook (6.0.2) and Python 3.7.3.

When I try to execute the notebook I get following error:
TypeError: a bytes-like object is required, not 'str'

I also uploaded the respective output as a screenshot. Can anyone advise here?

Screenshot 2019-12-07 at 11 19 12

@Syed-Hassam-Ali
Copy link

This Issue is simply resolved by changing "with open('%s_facebook_posts.csv' % page_id, 'wb') as file:" to "with open('%s_facebook_posts.csv' % page_id, 'w') as file:"
This code was written in python2 while you are using python3. Python2 takes input as a byte while python3 takes as str. So change the parameter 'wb' to 'w' while opening the csv (in scrape_facebook_page function). hope you got the point.

@Syed-Hassam-Ali
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants