Opened 6 years ago
Closed 6 years ago
#7186 closed defect (fixed)
gdal_retile.py fails if the filename contains "%" (percent) symbol.
Reported by: | OlegSerov | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | default | Version: | svn-trunk |
Severity: | normal | Keywords: | |
Cc: |
Description
gdal_retile.py fails if the filename contains "%" (percent) symbol..
Error message: `Traceback (most recent call last):
File "/home/ubuntu/.processing_server_env/bin/gdal_retile.py", line 1034, in <module>
sys.exit(main(sys.argv))
File "/home/ubuntu/.processing_server_env/bin/gdal_retile.py", line 940, in main
dsCreatedTileIndex = tileImage(minfo,ti)
File "/home/ubuntu/.processing_server_env/bin/gdal_retile.py", line 355, in tileImage
tilename=getTileName(minfo,ti, xIndex, yIndex)
File "/home/ubuntu/.processing_server_env/bin/gdal_retile.py", line 697, in getTileName
return format % (yIndex,xIndex)
ValueError: unsupported format character 'N' (0x4e) at index 59`
This happens on this line: https://trac.osgeo.org/gdal/browser/trunk/gdal/swig/python/scripts/gdal_retile.py?rev=28002#L712
Because it uses python formatting to insert x y coordinates. However, it does not escape the original string and the parts of original string tries to be formated.
You should escape all % sign with %%. E.g. a = a.replace('%', '%%')
Attachments (1)
Change History (4)
comment:1 by , 6 years ago
by , 6 years ago
Attachment: | gdal_retile.py.patch added |
---|
comment:2 by , 6 years ago
I've attached a patch for https://trac.osgeo.org/gdal/browser/branches/2.2/gdal/swig/python/scripts/gdal_retile.py
!!! I have not tested the patch.
Can you attach a patch or a modified version with your suggested fix ?