Bug report #14286

Saga in QGIS Processing do not support "no ascii filename" in certain algs

Added by Jean Hemmi about 8 years ago. Updated about 8 years ago.

Status:Closed
Priority:Normal
Assignee:Victor Olaya
Category:Processing/SAGA
Affected QGIS version:2.12.2 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed/implemented
Crashes QGIS or corrupts data:No Copied to github as #:22279

Description

From a QGIS plugin, I call through Processing different Saga algs : "clipgridwithpolygon", "contourlinesfromgrid"

The alg "clipgridwithpolygon" accept unicode filename with non ascii char.
The alg contourlinesfromgrid does not.
The code runs fine with "non ascii filename" but when a non ascci appears:

STACK TRACE

"C:/Users/xx/.qgis2/python/plugins\\PhysiocapAnalyseur\\Physiocap_intra_interpolation.py", line 273, in physiocap_creer_raster_iso
​      
File "C:/Users/xx/.qgis2/python/plugins\\processing\\tools\\general.py", line 71, in runalg
alg = Processing.runAlgorithm(algOrName, None, *args, **kwargs)
File "C:/Users/xx/.qgis2/python/plugins\\processing\\core\\Processing.py", line 337, in runAlgorithm
print 'Unable to execute algorithm\
' + msg
UnicodeEncodeError: 'ascii' codec can't encode character u'\\xe9' in position 90: ordinal not in range(128)

The portion of code

from __future__ import unicode_literals
import procesing
....
raster_dans_poly = processing.runalg("saga:clipgridwithpolygon",
                nom_raster_temp,
                nom_vignette,
                nom_raster)

nom_raster = raster_dans_poly[ 'OUTPUT']​
​iso_dans_poly_brut = processing.runalg("saga:contourlinesfromgrid",
                    nom_raster,
                    isoMin, isoMax, isoInterlignes,
                    None)​  # here is line 273 but nom_raster is the problem

My Question : is this a limitation on the SAGA side or in Processing ?
Is it possible to raise Processing or SAGA exception ?

Problem experienced on Win8 64 Bits Qgis 2.12.3 Processing 2.12.2 Saga 2.1.2

2016-04-05_QGIS_2.14.1-Essen_-_processing_log.png (113 KB) Jean Hemmi, 2016-04-05 05:19 AM

2016-04-05_QGIS_2.14.1-Essen_-_python_error.png (116 KB) Jean Hemmi, 2016-04-05 05:19 AM

Associated revisions

Revision 61a92e2f
Added by Alexander Bruy about 8 years ago

[processing] convert messages to unicode (fix #14286)

History

#1 Updated by Giovanni Manghi about 8 years ago

  • Status changed from Open to Feedback

have you tried run the same tool using the SAGA command line?

#2 Updated by Jean Hemmi about 8 years ago

Giovanni,

Using Processing directly (not from plugin), i confirm that with "inverseDistance" alg has the same probleme :
when the name of output file contains non ascii producing
'ascii' codec can't encode character u'\\xe9'

From the SAGA command line, non ascii char are supported.
Even if some traces are strange... the right interpolation named with not ascci char is OK

@100%
100%Save grid: C:\\Users\\xx\\Desktop\\DATA_PHY\\data\\testÚlÞv\\shapefile\\INTER_PARCE
LLAIRE\\jeanÙlev1...

100%okay

C:\\Program Files\\QGIS Lyon\\apps\\saga>saga_cmd grid_gridding 1 -SHAPES:C:\\Users\\xxx\\Desktop\\DATA_PHY\\data\\testélèv\\shapefile\\INTER_PARCELLAIRE\\testélèv_POINTS_UN
_CONTOUR_L93.shp -FIELD:DIAM -USER_GRID:C:\\Users\\xxx\\Desktop\\DATA_PHY\\data\\testé
lèv\\shapefile\\INTER_PARCELLAIRE\\jeanëlev1

@

#3 Updated by Alexander Bruy about 8 years ago

  • Status changed from Feedback to Closed

#4 Updated by Jean Hemmi about 8 years ago

I've test the fix under Win7 64 Bits, QGIS 2.14.1, Processing 2.1.12 & Saga 2.1.2 : it does not change this problem :

I send two screen shots:
  • the first give the processing log (the grid command)
  • the second the python error log

In the layer & canva, you can see the saga alg result (when file name is "jh"), but when the context is changes to "jéöh" , Processing raises a python error.
SAGA starts works creating the prj file but sdat it not created...

My Question : is this a limitation on the SAGA side or in Processing ?
Is it possible to catch Processing or SAGA exception ?

Thanks

#5 Updated by Giovanni Manghi about 8 years ago

  • Status changed from Reopened to Feedback
  • OS version deleted (Qgis 2.12.x Processing 2.12.2)
  • Operating System deleted (Windows 8 64 bits)
  • Target version deleted (Version 2.14)

Jean Hemmi wrote:

I've test the fix under Win7 64 Bits, QGIS 2.14.1, Processing 2.1.12 & Saga 2.1.2 : it does not change this problem :

are you sure you are using a version of Processing that includes the fix?

#6 Updated by Alexander Bruy about 8 years ago

Seems you tested same installation as previous.

Where you get this Processing 2.1.12? I can not find such version in plugins repository. Also note, that Processing in master has different version number.

#7 Updated by Jean Hemmi about 8 years ago

Ooups, it was a typo error.
Processing tested was 2.12.2 after re-installed from plugins repository.

I have not verified whether the fix was inside.
I'll have my "test machine" tomorrow and tell you.

#8 Updated by Giovanni Manghi about 8 years ago

  • Resolution set to fixed/implemented
  • Status changed from Feedback to Closed

Jean Hemmi wrote:

Ooups, it was a typo error.
Processing tested was 2.12.2 after re-installed from plugins repository.

this way you'll get an older, non patched version of Processing.
You have to remove any "processing" folder from .qgis2/python/plugins and then install QGIS 2.14

Please test this way, and reopen if necessary.

Also available in: Atom PDF