Bug report #5420

GRASS gives python error if input layer path contains non ascii chars

Added by Pedro Costa almost 8 years ago. Updated over 5 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Processing/GRASS
Affected QGIS version:2.4.0 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:worksforme
Crashes QGIS or corrupts data:No Copied to github as #:15080

Description

Hello to all,

This is my first intervention here so i hope that i'm doing this right.
My versions are:

OS: Windows 7 64 bits
QGIS: 1.7.4 revision 411aff6
sextante 1.0.4

If I tried execute any grass algorithm like v.buffer, without any vector in the qgis project, the tool seems to be working well (like image '1'.
But if i have a shapefile open in the project give me a error (like the image '2') and I can't execute any tool.

Is very strange. Does anyone know the resolution? This only happen with grass algorithms.

Thanks

1.png - image one (173 KB) Pedro Costa, 2012-04-20 06:44 AM

2.png - image two (218 KB) Pedro Costa, 2012-04-20 06:44 AM

History

#1 Updated by Giovanni Manghi almost 8 years ago

Hi Pedro,

check also the sextante log and post any message that can be useful (of there is something more than the python error already attached).

#2 Updated by Pedro Costa almost 8 years ago

Hi Giovanni,

I found the problem. If my shapes have in a directory named with special characters, like 'ã' or 'ç' gives me the error.
Only happen with some algorithms.

#3 Updated by Giovanni Manghi almost 8 years ago

  • Subject changed from Grass give a python error to GRASS gives python error if input layer path contains non ascii chars

#4 Updated by Giovanni Manghi over 7 years ago

this seems to be still true, the message is

Traceback (most recent call last):
File "C:\\OSGeo4W\\apps\\qgis-dev\\python\\plugins\\sextante\\core\\GeoAlgorithm.py", line 117, in execute
self.processAlgorithm(progress)
File "C:\\OSGeo4W\\apps\\qgis-dev\\python\\plugins\\sextante\\grass\\GrassAlgorithm.py", line 324, in processAlgorithm
self.consoleOutput = GrassUtils.executeGrass(commands, progress, outputCommands);
File "C:\\OSGeo4W\\apps\\qgis-dev\\python\\plugins\\sextante\\grass\\GrassUtils.py", line 262, in executeGrass
command = GrassUtils.prepareGrassExecution(commands)
File "C:\\OSGeo4W\\apps\\qgis-dev\\python\\plugins\\sextante\\grass\\GrassUtils.py", line 241, in prepareGrassExecution
GrassUtils.createGrassScript(commands)
File "C:\\OSGeo4W\\apps\\qgis-dev\\python\\plugins\\sextante\\grass\\GrassUtils.py", line 167, in createGrassScript
output.write(command + "\
")
UnicodeEncodeError: 'ascii' codec can't encode character u'\\xe7' in position 54: ordinal not in range(128)

#5 Updated by Pedro Venâncio over 7 years ago

Hi Giovanni,

Confirmed also on Linux:

Traceback (most recent call last):
  File "/usr/share/qgis/python/plugins/sextante/core/GeoAlgorithm.py", line 117, in execute
    self.processAlgorithm(progress)
  File "/usr/share/qgis/python/plugins/sextante/grass/GrassAlgorithm.py", line 324, in processAlgorithm
    self.consoleOutput = GrassUtils.executeGrass(commands, progress, outputCommands);
  File "/usr/share/qgis/python/plugins/sextante/grass/GrassUtils.py", line 262, in executeGrass
    command = GrassUtils.prepareGrassExecution(commands)
  File "/usr/share/qgis/python/plugins/sextante/grass/GrassUtils.py", line 248, in prepareGrassExecution
    GrassUtils.createGrassBatchJobFileFromGrassCommands(commands)
  File "/usr/share/qgis/python/plugins/sextante/grass/GrassUtils.py", line 176, in createGrassBatchJobFileFromGrassCommands
    fout.write(command + "\
")
UnicodeEncodeError: 'ascii' codec can't encode character u'\\xc1' in position 38: ordinal not in range(128)

Works fine if the same data is stored on a path without non ascii characters.

#6 Updated by Giovanni Manghi over 6 years ago

still true on qgis 2.0.1

#7 Updated by Alexander Bruy about 6 years ago

  • Status changed from Open to Feedback

Should be fixed in 3d6f17b067. Please test

#8 Updated by Giovanni Manghi almost 6 years ago

  • Status changed from Feedback to Closed

#9 Updated by Nicole Stoffels over 5 years ago

  • Assignee changed from Victor Olaya to Giovanni Manghi
  • Status changed from Closed to Reopened

Still not working on qgis 2.4.0 (this qgis uses python 2.7.3, gcc 4.6.3). I have 64-bit linux machine with ubuntu 12.4.

As far as I can see, in the commit 3d6f17b067 'open' is replaced by 'codecs.open' allowing utf-8 encoding. However, that does not fix the problem with non-ascii characters in the path.

#10 Updated by Giovanni Manghi over 5 years ago

  • Status changed from Reopened to Feedback

Nicole Stoffels wrote:

Still not working on qgis 2.4.0 (this qgis uses python 2.7.3, gcc 4.6.3). I have 64-bit linux machine with ubuntu 12.4.

As far as I can see, in the commit 3d6f17b067 'open' is replaced by 'codecs.open' allowing utf-8 encoding. However, that does not fix the problem with non-ascii characters in the path.

It works fine here on the very same OS. You are probably using an old version of Processing. Check in ~./qgis2/pyhton/plugins

if there is a "processing" folder then delete it, close qgis and try again.

#11 Updated by Giovanni Manghi over 5 years ago

  • Project changed from 78 to QGIS Application
  • Category deleted (59)
  • Affected QGIS version set to 2.4.0
  • Crashes QGIS or corrupts data set to No

#12 Updated by Giovanni Manghi over 5 years ago

  • Category set to Processing/GRASS

#13 Updated by Giovanni Manghi over 5 years ago

  • Resolution set to worksforme
  • Status changed from Feedback to Closed
  • Assignee deleted (Giovanni Manghi)

closing for lack of feedback, please reopen if necessary.

Also available in: Atom PDF