note its FileName is not an ascii-encodable string. Then I got the py state file containing following lines:
# ----------------------------------------------------------------
# setup the data processing pipelines
# ----------------------------------------------------------------
# create a new 'PLY Reader'
ply = PLYReader(FileNames=['C:/tmp/??-.ply'])
This state file cannot be loaded back through File-> Load State…
This situation is just same as my requirement to read file with non-ascii character in its path, so my question is how can I load such files through python scripts: macros, state files or especially using pvpython.exe for offscreen processing?
A work around I can think of is to edit the python state file manually to correct the non-utf8 char.
Another work around would be to use the python trace feature instead of the python state.
I have just tested Trace, it correctly generate the write code:
# create a new 'PLY Reader'
ply = PLYReader(FileNames=['C:/tmp/中.ply'])
but it cannot run through “python shell -> run scripts”, error message is:
Warning: In D:\ParaView56\VTK\IO\PLY\vtkPLYReader.cxx, line 135
vtkPLYReader (000001F667E1AFE0): Could not open PLY file
ERROR: In D:\ParaView56\VTK\Common\ExecutionModel\vtkExecutive.cxx, line 782
vtkPVCompositeDataPipeline (000001F6691B2040): Algorithm vtkFileSeriesReader(000001F6691B2130) returned failure for request: vtkInformation (000001F66964F970)
Debug: Off
Modified Time: 625380
Reference Count: 1
Registered Events: (none)
Request: REQUEST_DATA
FORWARD_DIRECTION: 0
ALGORITHM_AFTER_FORWARD: 1
FROM_OUTPUT_PORT: 0
It seems that even the character ‘中’ is encoded correctly in .py file, python interpretor still cannot decode this character correctly from py file.
Is there any way to specify encoding system for python interpretor embeded in paraview?
So Is there some thing I can do to read these files from python scripts, maybe specify coding system through paraview command line or compile a utf-8 version by changing some cmake configuration? after all I definately cannot go steal your computer:)
I have tested add “# -- coding: utf-8 --” to the scripts, but it does not work
Hi Mathieu,
My OS version is Windows10 1803, Language is Chinese(Simplified).
I have test another option may help us to address this issue:
In Windows Settings, there is an option introduced since Windows 1803 update package:
which on my computer like this:
with this check box checked, pvpython scripts can read files with non-ascii character in its path, but unfortunately, this option may cause error on other daily-use applications.
Based on information in the dialog above, it seems that Windows treats ParaView as “programs that do not support Unicode” which apperantly not true, so may be we explicitly tell Operation system that ParaView is capable of supporting unicode may fix this problem without enable that option system-wide?
@ymjia The unicode changes are not in Paraview 5.8, but if you build from the master branch of Paraview and VTK this problem is fixed. There’s no need to force Windows to use a global UTF-8 setting.
Thanks for your reply, I have tested master(12606e87b7bd9b258c79f9146a48b001541fffb0) cloned today(2020.04.10).
Things seems got worse:
I compiled from master, it can read files with all ascii charactors path, but when I try to open a file with non-ascii char, here is the gif:
yes, I have update submodule recursively, current git node in my local repo is af056c90caf6d553c6ebe9e2f430bd23c85a524c (2020.04.08 by Charles Gueunet)
ParaView master tracks VTK master pretty closely. For ParaView releases, there’s a branch in VTK to track that (mainly handled by ParaView developers rather than bothering the normal development process).