Jul-15-2018, 10:55 AM
Hello,
good sunday all
I have found this code on so that saves images from html files - from a folder.
I keep getting an error
soup = bs(open(os.path.join(root, f)).read())
File "C:\Python\Python36-32\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x90 in position 254: character maps to <undefined>
please will some one be kind enough to advise this error issue
I appreciate your help
good sunday all
I have found this code on so that saves images from html files - from a folder.
I keep getting an error
soup = bs(open(os.path.join(root, f)).read())
File "C:\Python\Python36-32\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x90 in position 254: character maps to <undefined>
import os, os.path
from PIL import Image
from bs4 import BeautifulSoup as bs
path = 'c:/Users/Dan/Desktop/c'
for root, dirs, files in os.walk(path):
for f in files:
soup = bs(open(os.path.join(root, f)).read())
for image in soup.findAll("img"):
print ("Image: %(src)s" % image)
im = Image.open(image)
im.save(path+image["src"], "png")
#https://stackoverflow.com/questions/9610728/how-do-i-extract-images-from-html-files-in-a-directoryI have researched for days - and cant work out what it wantsplease will some one be kind enough to advise this error issue
I appreciate your help
:)
Python newbie trying to learn the ropes
