I'm developing my QGIS-plugin. Unfortunately I faced a problem I can't solve. Plugin works pretty fine, until user hendles non-ascii characters inside input or output paths.
The problem occures when GDAL functions (
gdal_translate) are being executed via
os.system(). I read a lot about handling non-ascii characters, but I still can't fix that bug.
.decode('utf8') don't help in this case.
I still get the following error messages:
When I'm using Python:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position47: ordinal not in range(128)
When I try to run the problematic functions via OSGeo4W Shell:
ERROR 4: `E:/projekty/python/dane/ŕ╣│┐čˇŠ˝_raster.jpg' does not exist in the file system
So, according to what I've already written. How can one improve the following code, so it will not lead to error whenever non-ascii characters are or are not used within files paths?
import os def do_something(input_path, output_path): os.system('gdalwarp -co COMPRESS=LZW "' + input_path + '" "' + output_path +'"')