Paraview throws errors when using the Python shell.

Hello,

I have just downloaded and installed Paraview’s latest nightly build and I’m getting a Unicode error whenever I want to run a file inside the Python interpreter.

>>>   File "<string>", line 1 SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape >>> 

This error occurs whenever I attempt to run a script though Paraview’s interpreter regardless of the file size. A completely blank file will still throw this error as well. I downloaded and installed the same exact version on another machine and it works just fine.

Thank you.

What is your OS ?
Do you have anything in your PYTHONPATH env var ?
Do you have the same behavior with pvpython ?

Hi Mathieu, I am on Windows 10 and I have not changed my PYTHONPATH variable. Paraview is installed on my local drive C:\Program Files. If I save my script under C:\Users or any child to the Users directory I get the unicode error. Any other sibling directory to Users or Program Files works fine. For example if I create a folder named Git (which is a sibling of Users and Program Files) everything will work and my script will be able to run inside of Paraview’s shell. I do not have this issue with the published v5.7.0 build. I will also get the same error in pvpython.

Wow, I reproduce, thanks for testing that. It almost made it into 5.8 release which would have been bad.

I have a fix, but for me the error does not appear with pvpython, only the python shell within paraview.

Great I am glad I could help. Will your fix be available in the latest nightly build? I will try using pvpython again to test this.

(Edit): After checking with pvpython I didn’t have this issue. I did 100% run into this Unicode error yesterday, I can’t explain why I am not running into it now.

The fix is here, it will be merged soon and should be available in ParaView 5.8-RC2 if all goes well.
https://gitlab.kitware.com/paraview/paraview/merge_requests/3852

The fix has been merged, is present in the latest nightly and will be present in the next release.