Im trying to download a picture from the internet but once I use string formatting it gives me an Error: "UnicodeEncodeError: 'ascii' codec can't encode character '\xdf' in position 161: ordinal not in range(128)" If I remove string formatting the picture is downloadable.
I have already tried to encode and decode but nothings works.
def get_location(self):
self.key = self.key_entry.get()
self.location = self.location_entry.get()
self.zoom = self.zoom_entry.get()
self.type = self.type_entry.get()
self.url = "https://www.mapquestapi.com/staticmap/v4/getplacemap?key=%s&size=600,600&type=%s&imagetype=png&zoom=%s&scalebar=false&traffic=false&location=%s" % (self.key, self.type, self.zoom, self.location)
webbrowser.open_new_tab('%s' % self.url)
urllib.request.urlretrieve(self.url, "location.png")