[vtkusers] vtkOBJReader, Qt4 and German locale

Oliver Natt onatt at gmx.de
Sun Sep 11 15:26:36 EDT 2016


Dear users,

I found a very strange behaviour of vtkOBJReader which can be reproduced 
by the attached script 'test.py'. Interestingly, whether the script 
works or not depends on the locale: If I do the following, the script 
runs without problems and displays a teddy.

~/> LANG=en_US.UTF-8
~/> python test.py

However, when I do the following, the script stops working with the 
following error message:

~/> LANG=de_DE.UTF-8
~/> python test.py
ERROR: In 
/home/onatt/Downloads/vtk-py3-qt4/src/VTK-7.0.0/IO/Geometry/vtkOBJReader.cxx, 
line 193
vtkOBJReader (0x29cdf40): Error reading 'v' at line 1

I think the reason is, that in the german local the role of "." and "," 
are swapped. The english number "1,234.55" corresponds to the german 
number "1.234,55".

Another interesting observation is, that the script runs independently 
of the selected locale, if I remove the line

a = QApplication(["", ""])

The obvious solution would be to remove the line with "QApplication". 
However, I want to use the vtkOBJReader in a Qt-Application with the 
german locale. Do you have any suggestions how to get vtkOBJReader 
working in this particular situation?

I am running Arch Linux with Python 3.5.2, vtk 7.0.0, and qt 4.8.7

Best regards

Oliver

-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.obj
Type: application/x-tgif
Size: 91538 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160911/edf07a44/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.py
Type: text/x-python
Size: 494 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160911/edf07a44/attachment.py>


More information about the vtkusers mailing list