Instance of 'dict' has no 'replace' member

sinless199 at gmail.com sinless199 at gmail.com
Fri Feb 1 08:15:28 EST 2019


Hello guys can you help me to solve problem when i compile proram got error like this "Instance of 'dict' has no 'replace' member[no member](67;14)".
here you can see my code.
url = "http://mapa.um.warszawa.pl/mapviewer/foi"
querystring = {"request":"getfoi","version":"1.0","bbox":"${xmin}:${ymin}:${xmax}:${ymax}","width":"${imageWidth}","height":"${imageHeight}","theme":"dane_wawa.NMZ_WUP_WODA","clickable":"no","area":"yes","dstsrid":"2178","wholeimage":"yes","renderlabels":"yes","tid":"653_1461267","aw":"no"}
payload = ""
headers = {
    'cache-control': "no-cache",
    'Postman-Token': "d23cc8e3-423e-43a0-9d54-0cae251a4de9"
    }




if not os.path.exists(targetDir):
    os.makedirs(targetDir)
######################
# Main loop ##########
######################
for y in range(fullExtent['ymax'], fullExtent['ymin'], - tileSizeY):
	for x in range(fullExtent['xmin'], fullExtent['xmax'], tileSizeX):
		targetFile = open(targetDir + "\\" + str(x) + "_" + str(y) + ".png", "wb")
		url_link = querystring.replace("${ymin}", str(y - tileSizeY)).replace("${xmin}", str(x)).replace("${xmax}", str(x + tileSizeX)).replace("${ymax}", str(y)).replace("${imageWidth}", str(imageWidth)).replace("${imageHeight}",str(imageHeight))
		targetWorldFile = open(targetDir + "\\" + str(x) + "_" + str(y) + ".pgw", "w")
		print ("URL: " + url + "\n")
        for tryNum in range(0, retryTimes):
            try:
                response_get = requests.get(url, data=payload, headers=headers, 
     params=url_link)
                req = urllib2.Request(response_get.text[66:131], None, {'User-Agent': userAgentString})
                response = urllib2.urlopen(req)
                responseText = response.read()
                targetFile.write(responseText)
                targetWorldFile.write(str(pixelSizeX) + "\n" + str(0.0000000) + "\n" + str(0.0000000)+ "\n" + str(-pixelSizeY) + "\n" + str(y - tileSizeY) + "\n" + str(x + tileSizeX))
            except Exception:
                img = Image.new('RGBA', (imageWidth, imageHeight))
                img.save(targetFile)
                pass


More information about the Python-list mailing list