openai-cookbook
openai-cookbook copied to clipboard
'charmap' codec can't encode characters in position 455-456: character maps to
Tried adding arguement encode="utf-8", in open statement but could not execute program. After adding arguement encode it gives this error
OSError Traceback (most recent call last) Cell In[37], line 136 133 queue.append(link) 134 seen.add(link) --> 136 crawl(full_url)
Cell In[37], line 115, in crawl(url) 112 print(url) # for debugging and to see the progress 114 # Save text from the url to a .txt file --> 115 with open('text/'+local_domain+'/'+url[8:].replace("/", "_") + ".txt", "w",encoding="utf-8") as f: 116 117 # Get the text from the URL using BeautifulSoup 118 soup = BeautifulSoup(requests.get(url).text, "html.parser") 120 # Get the text but remove the tags
Tried adding arguement encode="utf-8", in open statement but could not execute program. After adding arguement encode it gives this error
OSError Traceback (most recent call last) Cell In[37], line 136 133 queue.append(link) 134 seen.add(link) --> 136 crawl(full_url)
Cell In[37], line 115, in crawl(url) 112 print(url) # for debugging and to see the progress 114 # Save text from the url to a .txt file --> 115 with open('text/'+local_domain+'/'+url[8:].replace("/", "_") + ".txt", "w",encoding="utf-8") as f: 116 117 # Get the text from the URL using BeautifulSoup 118 soup = BeautifulSoup(requests.get(url).text, "html.parser") 120 # Get the text but remove the tags
If anyone resolved this problem then please help me.
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 10 days.
This issue was closed because it has been stalled for 10 days with no activity.