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

Problem with phython script #102

Open
so13839 opened this issue Sep 11, 2015 · 0 comments
Open

Problem with phython script #102

so13839 opened this issue Sep 11, 2015 · 0 comments

Comments

@so13839
Copy link

so13839 commented Sep 11, 2015

Dear all,

I am having a problem with a phython code below

CODE
print "review_number:",review_number
if review_number !=None and review_number != "" :
if int(review_number)>0:
count=0
while count<=(int(review_number)/10):
url_review=unicodedata.normalize('NFKD', url_info).encode('ascii','ignore')+"/reviews/"+unicodedata.normalize('NFKD',unicode(count)).encode('ascii','ignore')
print url_review
page = myopener.open(url_review)
soup = BeautifulSoup(page,"html")
reviwes=soup.findAll(class_="storefront__review divider bottom padding-listItem")
for review in reviwes:
name_reviwer=review.find("span", {"itemprop":"name"}).get_text()
rating_reviwer=review.find(class_="m-review").find("span", class_="squeeze").get("star-rating")
review_text=review.find("p",{"itemprop":"reviewBody"}).get_text().replace("\n","")
# write data in All Reviews.csv file
file_review.writerow([name,name_reviwer, review_text,rating_reviwer])
count =count+1

Below is the error I am getting

Traceback (most recent call last):
File "data_mining.py", line 150, in
url_review=unicodedata.normalize('NFKD', url_info).encode('ascii','ignore')+"/reviews/"+unicodedata.normalize('NFKD',unicode(count)).encode('ascii','ignore')
TypeError: must be unicode, not str

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

1 participant