MapTilesDownloader icon indicating copy to clipboard operation
MapTilesDownloader copied to clipboard

No Downloads and Errors in code window

Open Davierooker opened this issue 3 years ago • 4 comments

Running Windows 10, can get the app loaded and select area but no download. Exception happened during processing of request from ('127.0.0.1', 11709) Traceback (most recent call last): File "C:\Users\cwilson.KORBEN\AppData\Local\Programs\Python\Python36\lib\socketserver.py", line 639, in process_request_thread self.finish_request(request, client_address) File "C:\Users\cwilson.KORBEN\AppData\Local\Programs\Python\Python36\lib\socketserver.py", line 361, in finish_request self.RequestHandlerClass(request, client_address, self) File "C:\Users\cwilson.KORBEN\AppData\Local\Programs\Python\Python36\lib\socketserver.py", line 696, in init self.handle() File "C:\Users\cwilson.KORBEN\AppData\Local\Programs\Python\Python36\lib\http\server.py", line 418, in handle self.handle_one_request() File "C:\Users\cwilson.KORBEN\AppData\Local\Programs\Python\Python36\lib\http\server.py", line 406, in handle_one_request method() File "server.py", line 153, in do_POST self.writerByType(outputType).addMetadata(lock, os.path.join("output", outputDirectory), filePath, outputFile, "Map Tiles Downloader via AliFlux", "png", boundsArray, centerArray, minZoom, maxZoom, "mercator", 256 * outputScale) AttributeError: 'NoneType' object has no attribute 'addMetadata'

Davierooker avatar Dec 13 '20 19:12 Davierooker

I am also getting this same error. did you find any solution ?

apaleja avatar Jul 01 '21 10:07 apaleja

you can print outputType value for check reason

Dawson-Jiang avatar Sep 07 '21 15:09 Dawson-Jiang

I have this problem under Ubuntu and not Windows. In server.py, line 133 you'll see

outputDirectory = str(postvars['outputDirectory'][0])

If you print out the value with the following you get different values under Windows and Ubuntu

print("postvars['outputDirectory'][0]: " + str(postvars['outputDirectory'][0]))

Under ubuntu this gives b'{timestamp}' and under windows it gives the correct {timestamp}

I'm not a Python guy but it seems str conversions are handled differently under each OS. On a quick Google search it's something to do with being a byte array and not understanding the character encoding when using str(). Anyway in Ubuntu I swapped out that block of code for this

elif parts.path == '/start-download':
	outputType = str(postvars['outputType'][0], 'utf-8')
	outputScale = int(postvars['outputScale'][0])
	outputDirectory = str(postvars['outputDirectory'][0], 'utf-8')
	outputFile = str(postvars['outputFile'][0], 'utf-8')
	minZoom = int(postvars['minZoom'][0])
	maxZoom = int(postvars['maxZoom'][0])
	timestamp = int(postvars['timestamp'][0])
	bounds = str(postvars['bounds'][0], 'utf-8')
	boundsArray = map(float, bounds.split(","))
	center = str(postvars['center'][0], 'utf-8')
	centerArray = map(float, center.split(","))

Note all str functions having the second argument passed in. Anyway there is probably a correct way to fix this, but this got it running for me for now.

If I get time to figure it out properly I'll post back.

RussellTaylor83 avatar Sep 13 '21 18:09 RussellTaylor83

I'm currently porting the code to Electron since there are too many python issues including version confusions and performance hits. The v2 will be significantly faster and easier to run

AliFlux avatar Oct 02 '21 12:10 AliFlux